{"action":"created","comment":{"url":"https://api.github.com/repos/marmelab/ng-admin/pulls/comments/87794912","pull_request_review_id":8391129,"id":87794912,"diff_hunk":"@@ -181,3 +181,21 @@ entity.errorMessage(function (response) {\n     return 'Global error: ' + response.status + '(' + response.data + ')';\n });\n ```\n+## Customizing HTTP Error Messages\n+If you want to override, patch or extend the way HTTP error are handled by the ng-admin Http Error Service (../src/javascripts/ng-admin/Main/component/provider/HttpErrorService.js) then you may use an [Angular decorator](https://docs.angularjs.org/guide/decorators), as per the below example:\n+```js\n+// Change HTTP 403 error notification to display them as information and not errors ('humane-flatty-info' instead of 'humane-flatty-error')\n+myApp.config([ '$provide', function($provide) {\n+  $provide.decorator('httpErrorService', ['$delegate', '$translate', 'notification', function $httpErrorDecorator($delegate, $translate, notification) {\n+      var handle_403_error = $delegate.handle_403_error;","path":"doc/Theming.md","position":10,"original_position":10,"commit_id":"ad08aaf07bfc93e6d37b0c67f6463e691d3eb425","original_commit_id":"ad08aaf07bfc93e6d37b0c67f6463e691d3eb425","user":{"login":"jpetitcolas","id":688373,"avatar_url":"https://avatars.githubusercontent.com/u/688373?v=3","gravatar_id":"","url":"https://api.github.com/users/jpetitcolas","html_url":"https://github.com/jpetitcolas","followers_url":"https://api.github.com/users/jpetitcolas/followers","following_url":"https://api.github.com/users/jpetitcolas/following{/other_user}","gists_url":"https://api.github.com/users/jpetitcolas/gists{/gist_id}","starred_url":"https://api.github.com/users/jpetitcolas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpetitcolas/subscriptions","organizations_url":"https://api.github.com/users/jpetitcolas/orgs","repos_url":"https://api.github.com/users/jpetitcolas/repos","events_url":"https://api.github.com/users/jpetitcolas/events{/privacy}","received_events_url":"https://api.github.com/users/jpetitcolas/received_events","type":"User","site_admin":false},"body":"Use a `const` (we are already writing our snippets in ES6)","created_at":"2016-11-14T12:54:26Z","updated_at":"2016-11-14T12:58:11Z","html_url":"https://github.com/marmelab/ng-admin/pull/1245#discussion_r87794912","pull_request_url":"https://api.github.com/repos/marmelab/ng-admin/pulls/1245","_links":{"self":{"href":"https://api.github.com/repos/marmelab/ng-admin/pulls/comments/87794912"},"html":{"href":"https://github.com/marmelab/ng-admin/pull/1245#discussion_r87794912"},"pull_request":{"href":"https://api.github.com/repos/marmelab/ng-admin/pulls/1245"}}},"pull_request":{"url":"https://api.github.com/repos/marmelab/ng-admin/pulls/1245","id":93533820,"html_url":"https://github.com/marmelab/ng-admin/pull/1245","diff_url":"https://github.com/marmelab/ng-admin/pull/1245.diff","patch_url":"https://github.com/marmelab/ng-admin/pull/1245.patch","issue_url":"https://api.github.com/repos/marmelab/ng-admin/issues/1245","number":1245,"state":"open","locked":false,"title":"Better http error handling","user":{"login":"Phocea","id":724262,"avatar_url":"https://avatars.githubusercontent.com/u/724262?v=3","gravatar_id":"","url":"https://api.github.com/users/Phocea","html_url":"https://github.com/Phocea","followers_url":"https://api.github.com/users/Phocea/followers","following_url":"https://api.github.com/users/Phocea/following{/other_user}","gists_url":"https://api.github.com/users/Phocea/gists{/gist_id}","starred_url":"https://api.github.com/users/Phocea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Phocea/subscriptions","organizations_url":"https://api.github.com/users/Phocea/orgs","repos_url":"https://api.github.com/users/Phocea/repos","events_url":"https://api.github.com/users/Phocea/events{/privacy}","received_events_url":"https://api.github.com/users/Phocea/received_events","type":"User","site_admin":false},"body":"Modified the way ng-admin is handling HTTP errors so it can easily be customised:\r\n\r\n- Renamed ErrorHandler to HttpErrorHandler to avoid confusion.\r\n- Created a HttpErrorService in charge of taking the appropriate action depending on the HTTP code error.\r\n- Added default behavior for 403 error (as discussed with @jpetitcolas )\r\n- Added example of using Angular decorator to customise the service.","created_at":"2016-11-14T09:38:00Z","updated_at":"2016-11-14T12:58:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"074afdaf8a77fcafe3f460b50e9a6ee3c0107935","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/marmelab/ng-admin/pulls/1245/commits","review_comments_url":"https://api.github.com/repos/marmelab/ng-admin/pulls/1245/comments","review_comment_url":"https://api.github.com/repos/marmelab/ng-admin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/marmelab/ng-admin/issues/1245/comments","statuses_url":"https://api.github.com/repos/marmelab/ng-admin/statuses/ad08aaf07bfc93e6d37b0c67f6463e691d3eb425","head":{"label":"Phocea:Better-HTTP-Error-Handling","ref":"Better-HTTP-Error-Handling","sha":"ad08aaf07bfc93e6d37b0c67f6463e691d3eb425","user":{"login":"Phocea","id":724262,"avatar_url":"https://avatars.githubusercontent.com/u/724262?v=3","gravatar_id":"","url":"https://api.github.com/users/Phocea","html_url":"https://github.com/Phocea","followers_url":"https://api.github.com/users/Phocea/followers","following_url":"https://api.github.com/users/Phocea/following{/other_user}","gists_url":"https://api.github.com/users/Phocea/gists{/gist_id}","starred_url":"https://api.github.com/users/Phocea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Phocea/subscriptions","organizations_url":"https://api.github.com/users/Phocea/orgs","repos_url":"https://api.github.com/users/Phocea/repos","events_url":"https://api.github.com/users/Phocea/events{/privacy}","received_events_url":"https://api.github.com/users/Phocea/received_events","type":"User","site_admin":false},"repo":{"id":69880515,"name":"ng-admin","full_name":"Phocea/ng-admin","owner":{"login":"Phocea","id":724262,"avatar_url":"https://avatars.githubusercontent.com/u/724262?v=3","gravatar_id":"","url":"https://api.github.com/users/Phocea","html_url":"https://github.com/Phocea","followers_url":"https://api.github.com/users/Phocea/followers","following_url":"https://api.github.com/users/Phocea/following{/other_user}","gists_url":"https://api.github.com/users/Phocea/gists{/gist_id}","starred_url":"https://api.github.com/users/Phocea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Phocea/subscriptions","organizations_url":"https://api.github.com/users/Phocea/orgs","repos_url":"https://api.github.com/users/Phocea/repos","events_url":"https://api.github.com/users/Phocea/events{/privacy}","received_events_url":"https://api.github.com/users/Phocea/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Phocea/ng-admin","description":"Add an AngularJS admin GUI to any RESTful API","fork":true,"url":"https://api.github.com/repos/Phocea/ng-admin","forks_url":"https://api.github.com/repos/Phocea/ng-admin/forks","keys_url":"https://api.github.com/repos/Phocea/ng-admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Phocea/ng-admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Phocea/ng-admin/teams","hooks_url":"https://api.github.com/repos/Phocea/ng-admin/hooks","issue_events_url":"https://api.github.com/repos/Phocea/ng-admin/issues/events{/number}","events_url":"https://api.github.com/repos/Phocea/ng-admin/events","assignees_url":"https://api.github.com/repos/Phocea/ng-admin/assignees{/user}","branches_url":"https://api.github.com/repos/Phocea/ng-admin/branches{/branch}","tags_url":"https://api.github.com/repos/Phocea/ng-admin/tags","blobs_url":"https://api.github.com/repos/Phocea/ng-admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Phocea/ng-admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Phocea/ng-admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/Phocea/ng-admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Phocea/ng-admin/statuses/{sha}","languages_url":"https://api.github.com/repos/Phocea/ng-admin/languages","stargazers_url":"https://api.github.com/repos/Phocea/ng-admin/stargazers","contributors_url":"https://api.github.com/repos/Phocea/ng-admin/contributors","subscribers_url":"https://api.github.com/repos/Phocea/ng-admin/subscribers","subscription_url":"https://api.github.com/repos/Phocea/ng-admin/subscription","commits_url":"https://api.github.com/repos/Phocea/ng-admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/Phocea/ng-admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/Phocea/ng-admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/Phocea/ng-admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/Phocea/ng-admin/contents/{+path}","compare_url":"https://api.github.com/repos/Phocea/ng-admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Phocea/ng-admin/merges","archive_url":"https://api.github.com/repos/Phocea/ng-admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Phocea/ng-admin/downloads","issues_url":"https://api.github.com/repos/Phocea/ng-admin/issues{/number}","pulls_url":"https://api.github.com/repos/Phocea/ng-admin/pulls{/number}","milestones_url":"https://api.github.com/repos/Phocea/ng-admin/milestones{/number}","notifications_url":"https://api.github.com/repos/Phocea/ng-admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Phocea/ng-admin/labels{/name}","releases_url":"https://api.github.com/repos/Phocea/ng-admin/releases{/id}","deployments_url":"https://api.github.com/repos/Phocea/ng-admin/deployments","created_at":"2016-10-03T14:47:43Z","updated_at":"2016-10-03T14:47:45Z","pushed_at":"2016-11-14T09:46:23Z","git_url":"git://github.com/Phocea/ng-admin.git","ssh_url":"git@github.com:Phocea/ng-admin.git","clone_url":"https://github.com/Phocea/ng-admin.git","svn_url":"https://github.com/Phocea/ng-admin","homepage":"http://ng-admin-book.marmelab.com/","size":69009,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"marmelab:master","ref":"master","sha":"78b30025aacf7d5ed496b06aa5ba023b708ff793","user":{"login":"marmelab","id":3116319,"avatar_url":"https://avatars.githubusercontent.com/u/3116319?v=3","gravatar_id":"","url":"https://api.github.com/users/marmelab","html_url":"https://github.com/marmelab","followers_url":"https://api.github.com/users/marmelab/followers","following_url":"https://api.github.com/users/marmelab/following{/other_user}","gists_url":"https://api.github.com/users/marmelab/gists{/gist_id}","starred_url":"https://api.github.com/users/marmelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marmelab/subscriptions","organizations_url":"https://api.github.com/users/marmelab/orgs","repos_url":"https://api.github.com/users/marmelab/repos","events_url":"https://api.github.com/users/marmelab/events{/privacy}","received_events_url":"https://api.github.com/users/marmelab/received_events","type":"Organization","site_admin":false},"repo":{"id":20059361,"name":"ng-admin","full_name":"marmelab/ng-admin","owner":{"login":"marmelab","id":3116319,"avatar_url":"https://avatars.githubusercontent.com/u/3116319?v=3","gravatar_id":"","url":"https://api.github.com/users/marmelab","html_url":"https://github.com/marmelab","followers_url":"https://api.github.com/users/marmelab/followers","following_url":"https://api.github.com/users/marmelab/following{/other_user}","gists_url":"https://api.github.com/users/marmelab/gists{/gist_id}","starred_url":"https://api.github.com/users/marmelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marmelab/subscriptions","organizations_url":"https://api.github.com/users/marmelab/orgs","repos_url":"https://api.github.com/users/marmelab/repos","events_url":"https://api.github.com/users/marmelab/events{/privacy}","received_events_url":"https://api.github.com/users/marmelab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/marmelab/ng-admin","description":"Add an AngularJS admin GUI to any RESTful API","fork":false,"url":"https://api.github.com/repos/marmelab/ng-admin","forks_url":"https://api.github.com/repos/marmelab/ng-admin/forks","keys_url":"https://api.github.com/repos/marmelab/ng-admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marmelab/ng-admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marmelab/ng-admin/teams","hooks_url":"https://api.github.com/repos/marmelab/ng-admin/hooks","issue_events_url":"https://api.github.com/repos/marmelab/ng-admin/issues/events{/number}","events_url":"https://api.github.com/repos/marmelab/ng-admin/events","assignees_url":"https://api.github.com/repos/marmelab/ng-admin/assignees{/user}","branches_url":"https://api.github.com/repos/marmelab/ng-admin/branches{/branch}","tags_url":"https://api.github.com/repos/marmelab/ng-admin/tags","blobs_url":"https://api.github.com/repos/marmelab/ng-admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marmelab/ng-admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marmelab/ng-admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/marmelab/ng-admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marmelab/ng-admin/statuses/{sha}","languages_url":"https://api.github.com/repos/marmelab/ng-admin/languages","stargazers_url":"https://api.github.com/repos/marmelab/ng-admin/stargazers","contributors_url":"https://api.github.com/repos/marmelab/ng-admin/contributors","subscribers_url":"https://api.github.com/repos/marmelab/ng-admin/subscribers","subscription_url":"https://api.github.com/repos/marmelab/ng-admin/subscription","commits_url":"https://api.github.com/repos/marmelab/ng-admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/marmelab/ng-admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/marmelab/ng-admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/marmelab/ng-admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/marmelab/ng-admin/contents/{+path}","compare_url":"https://api.github.com/repos/marmelab/ng-admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marmelab/ng-admin/merges","archive_url":"https://api.github.com/repos/marmelab/ng-admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marmelab/ng-admin/downloads","issues_url":"https://api.github.com/repos/marmelab/ng-admin/issues{/number}","pulls_url":"https://api.github.com/repos/marmelab/ng-admin/pulls{/number}","milestones_url":"https://api.github.com/repos/marmelab/ng-admin/milestones{/number}","notifications_url":"https://api.github.com/repos/marmelab/ng-admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marmelab/ng-admin/labels{/name}","releases_url":"https://api.github.com/repos/marmelab/ng-admin/releases{/id}","deployments_url":"https://api.github.com/repos/marmelab/ng-admin/deployments","created_at":"2014-05-22T12:00:10Z","updated_at":"2016-11-14T08:00:50Z","pushed_at":"2016-11-14T09:46:23Z","git_url":"git://github.com/marmelab/ng-admin.git","ssh_url":"git@github.com:marmelab/ng-admin.git","clone_url":"https://github.com/marmelab/ng-admin.git","svn_url":"https://github.com/marmelab/ng-admin","homepage":"http://ng-admin-book.marmelab.com/","size":80540,"stargazers_count":3258,"watchers_count":3258,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":587,"mirror_url":null,"open_issues_count":150,"forks":587,"open_issues":150,"watchers":3258,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/marmelab/ng-admin/pulls/1245"},"html":{"href":"https://github.com/marmelab/ng-admin/pull/1245"},"issue":{"href":"https://api.github.com/repos/marmelab/ng-admin/issues/1245"},"comments":{"href":"https://api.github.com/repos/marmelab/ng-admin/issues/1245/comments"},"review_comments":{"href":"https://api.github.com/repos/marmelab/ng-admin/pulls/1245/comments"},"review_comment":{"href":"https://api.github.com/repos/marmelab/ng-admin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/marmelab/ng-admin/pulls/1245/commits"},"statuses":{"href":"https://api.github.com/repos/marmelab/ng-admin/statuses/ad08aaf07bfc93e6d37b0c67f6463e691d3eb425"}}}}
{"actor":{"display_login":"jpetitcolas"}}