You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 17, 2020. It is now read-only.
What is frustrating you?
The catch block of most Promises have multiple predicates and the errors are handled in different ways in different services.
For eg: The lines here and here handle the error in the service layer and splits it into AuthenticationErr and <Custom>Err which is then handled in the component level on what to do with them whereas, here, we return the error code which is to be handled in React components layer.
Your solution
We should come up with a strict Error Handling mechanism. This could involve extending native error types and adding multiple catch blocks for our usecases.
try {
changeLogsService.createChange(change);
} catch (e if e instanceof AuthenticationError) {
redirectToLogin();
} catch (e) {
raiseCreateChangeError(e);
}
Alternatives considered
We could continue what we are already doing with respect to how the errors are handled in components. That is.,