Default and customizable error messages
See original GitHub issueHello, I’d like to be able to have a default notifications in case of service errors while being able to override it if I want to notify the user with custom messages.
As a starting point I’ve overridden the errorInterceptor in my configure
stage of the app:
App.config ['RestangularProvider', (RestangularProvider) ->
RestangularProvider.setErrorInterceptor (response, promise) ->
toastr.error 'There has been an error contacting the server, please try again'
]
This way on every error toastr shows the default notification. Now, since I want to be able to override the message or do custom actions, I’ve tried to use the promise trying to get it returned valued using promise.reject()
so in my controllers I could:
UserService.get('me').then (user) ->
$scope.user = user
$scope.userLoading = false
, ->
toastr.error 'There has been an error loading the current user!'
false
and checking the return value in my default error handling I’m able to skip the default behaviour. However from promise.reject() I always get undefined as result, is there a way to achieve this?
Issue Analytics
- State:
- Created 10 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Customizing a Default Error Message (Sun Identity Manager ...
You can customize these default error messages by modifying attributes in the ErrorUIConfig object provided with that message.
Read more >Create customized error messages for your web page - IU KB
The default configuration is to output a simple hardcoded error message (option 1). Options 2-4 are configured within the .htaccess file.
Read more >Customize OmniScript Error Messages - Salesforce Help
A default message that returns when no Custom Error Messages are matched or defined. The Default Error Message property is not available in...
Read more >Customize Error Messages in your Web Applications
There are two ways to add customized error messages: on an application ... select the Default Error Message you wish to customize (in...
Read more >Customize error messages
You can customize error messages that appear when you launch third party applications. These messages have default content but you may want to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mgonto Why not run the local error handlers first, before the global handler? This is how most web frameworks work as it allows the local context to override the default global context.
I’m having this issue too. I think that the errorInterceptor should somehow be able to tell whether the re’s a reject callback for the promise defined for a particular request. That way we could avoid handling an error if it’s being customly handled somewhere else in our code
A knieve example: