react-native-exception-handler
react-native-exception-handler copied to clipboard
JS error from Async function becomes undefined when it is catched
I use setJSExceptionHandler. My code has some loading logic using an async function. When my server is down, it supposes to throw an error. My catch block actually logs network error to the console, but this exception handler can't get the error context, always complaining it is undefined. I suspect it has something to do with the nature of async function. Any idea?

`const _appLoadingAsync = async () => { try { const refreshToken = await SecureStore.getItemAsync('refreshToken'); let authToken = null; if (refreshToken !== null) { const config = { headers: { Authorization: Bearer ${refreshToken} }, }; const response = await axiosBase.put( '/auth/refresh_token', null, config ); authToken = response.data.authToken; }
dispatch({ type: ActionType.RestoreToken, token: authToken });
} catch (e) {
// tslint:disable-next-line: no-console
console.log(e);
throw new Error('my error');
}
};`
Has this been resolved, yet? Displaying network errors is the only reason, I wanted to use this library :(