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

RFC: Error object to be passed to the error handler instead of error stack string #2824

Closed
r0ss0neri opened this issue Dec 16, 2020 · 0 comments · Fixed by #2853
Closed

RFC: Error object to be passed to the error handler instead of error stack string #2824

r0ss0neri opened this issue Dec 16, 2020 · 0 comments · Fixed by #2853

Comments

@r0ss0neri
Copy link
Contributor

r0ss0neri commented Dec 16, 2020

Describe any alternatives/workarounds you're currently using

I am wondering about the reason why error.stack is passed to the error handler instead of entire error.

My use case is that I want to handle all script errors and get an error.message string to be show in the notification. Below example of custom error handler:

...
export class CustomErrorHandlerService extends ErrorHandler {
   ...
   handleError(error: any): void {
       if (error instanceof Error) {
           // service consume entire "error" object to get a "message" and "stack" for own needs
           this.scriptErrorHandler.handle(error); 
       }

       super.handleError(error);
   }
}

If accepted, I would be willing to submit a PR for this feature

[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No

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

Successfully merging a pull request may close this issue.

2 participants