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 has been 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.,
rohithbalaji123
changed the title
[Refactor]
[Refactor] Impose definite error handling mechanism in Client Services and APIs
Jun 28, 2020
rohithbalaji123
changed the title
[Refactor] Impose definite error handling mechanism in Client Services and APIs
[Refactor] Impose definite error handling mechanism in Client Classes
Jun 28, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Alternatives considered
We could continue what we are already doing with respect to how the errors are handled in components. That is.,
But, we should maintain consistency on what is returned to each layers(React Components, Services and GraphQLAPIs)
The text was updated successfully, but these errors were encountered: