So guys I have 2 functions, the first is named child Function(), the second is parentFunction(). So I'm trying to get an error from childFunction(), where childFunction() contains the following code
async childFunction() {
await getFromApi()
}
and i tried to call childFunction() from parentFunction() like this
async parentFunction() {
try {
await childFunction()
} catch (e) {
console.log(e)
}
}
my expected error
Uncaught (in promise) TypeError: Failed to fetch
at fetchWith (fetch.browser.js?273a:103:1)
at Client.fetch (http.js?670b:132:1)
at Client.fetch (core.js?0abd:182:1)
at Client.post (http.js?670b:174:1)
at addAll (add-all.js?74f2:31:1)
at async last (index.js?9975:13:1)
at async Object.add (add.js?59bb:18:1)
but I don't get any error or console. So the error can only be accessed in childFunction() only when I use try-catch in childFunction(). Even then I can't send the error to parentFunction(). So my question, how to send error from childFunction() to parentFunction(). Thank you in advance