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
Shouldn't there be a global configuration to handle failed request instead of handling it in the error of every request?
Eg: I was handle session failures and instead of handling it in every request a global interceptor like Angular JS would be great. https://djds4rce.wordpress.com/2013/08/13/understanding-angular-http-interceptors/
The text was updated successfully, but these errors were encountered:
We considered the global error handler option when we implemented revocable sessions earlier, and decided against it. We believe it makes your code more confusing to read/debug by a collaborator because the handler is not explicitly stated in the request code. In addition, when the session token becomes invalid, the best error handling logic could be dependent on where the user is in the app; you may want to perform additional operations before forcing the user to log in again (e.g. perhaps save the currently unfinished document to local storage so it can be recovered after the user logs in again).
If you want to use the same error handling logic for all calls, we recommend the following pattern:
let globalErrorHandler = (error) => {
switch (error.code) {
case Parse.Error.INVALID_SESSION_TOKEN:
// Do whatever makes sense for invalid session
case Parse.Error.SOME_OTHER_ERROR_CODE:
// Handle another type of error
...
}
}
// Then refer to this error handler from all network request calls in your app
obj.save().then(function(obj) { ... }, globalErrorHandler);
Shouldn't there be a global configuration to handle failed request instead of handling it in the error of every request?
Eg: I was handle session failures and instead of handling it in every request a global interceptor like Angular JS would be great.
https://djds4rce.wordpress.com/2013/08/13/understanding-angular-http-interceptors/
The text was updated successfully, but these errors were encountered: