-
Notifications
You must be signed in to change notification settings - Fork 725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Http error handling #1273
Http error handling #1273
Conversation
Replace #1257 .. was getting too messy |
@jpetitcolas All yours :) |
Fix #1031 |
``` | ||
Bind the decorator to your application: | ||
```js | ||
myApp.decorator('httpErrorService',require('HttpErrorDecorator')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/httpErrorService/HttpErrorService/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to me. I brought a few minor changes (essentially some renaming from httpErrorService
to HttpErrorService
). I also tested documentation, everything is good. Mergeable if tests are green.
Tests are green. @Kmaschta, I let you merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, it will be easier for all.
A final review with few details and we're good!
this.handle404Error(event, error); | ||
break; | ||
case 403: | ||
this.handle403Error(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, be consistent and give the same API for all the handlers: (event, error)
or (error, event)
.
I'm even in favor of (error, event, toState, toParams, fromState, fromParams)
.
It will be more customable for the next developers and the doc will be more clear too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you do this I get sonar style check errors because the parameters are not used in the method (Unused function parameters should be removed javascript : UnusedFunctionArgument)
Nothing is mentionned about this in google guidelines.
Dev can override this in the decorator anyway
@@ -38,6 +38,7 @@ export default function translate($translateProvider) { | |||
'NEXT': 'Next »', | |||
'DETAIL': 'Detail', | |||
'STATE_CHANGE_ERROR': 'State change error: {{ message }}', | |||
'STATE_FORBIDDEN_ERROR': 'A server 403 error occured: {{ message }}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A server 403 error occured
to A permission error occured
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well 403 error could be something else than permission, so not sure. I will let you debate with @jpetitcolas as this was is wording for the error when we started discussing this issue (#1031 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let use current message, as it will be useful for users to report problem to their developper. Moreover, it is easily overridable now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
Hopefully the final chapter :)
I have modified the documentation example and using similar code our deployment