Skip to content
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

Merged
merged 11 commits into from
Dec 20, 2016
Merged

Http error handling #1273

merged 11 commits into from
Dec 20, 2016

Conversation

Phocea
Copy link
Contributor

@Phocea Phocea commented Dec 9, 2016

Hopefully the final chapter :)
I have modified the documentation example and using similar code our deployment

@Phocea
Copy link
Contributor Author

Phocea commented Dec 9, 2016

Replace #1257 .. was getting too messy

@Phocea
Copy link
Contributor Author

Phocea commented Dec 9, 2016

@jpetitcolas All yours :)

@Phocea
Copy link
Contributor Author

Phocea commented Dec 10, 2016

Fix #1031

@jpetitcolas jpetitcolas added this to the 1.0 milestone Dec 15, 2016
```
Bind the decorator to your application:
```js
myApp.decorator('httpErrorService',require('HttpErrorDecorator'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/httpErrorService/HttpErrorService/

Copy link
Contributor

@jpetitcolas jpetitcolas left a 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.

@jpetitcolas
Copy link
Contributor

Tests are green. @Kmaschta, I let you merge?

Copy link
Contributor

@Kmaschta Kmaschta left a 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);
Copy link
Contributor

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.

Copy link
Contributor Author

@Phocea Phocea Dec 20, 2016

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 }}',
Copy link
Contributor

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?

Copy link
Contributor Author

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))

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants