Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
How to Properly handle errors with ErrorHandler in Angular

I created a class that implements ErrorHandler :

@Injectable()
export class GlobalErrorHandler implements ErrorHandler {
    
    constructor(
        private errorsService: ErrorsService
        ) { }
  
    handleError(error: any) {
        const errorParsed: ParsedError = this.errorsService.getError(error);
    }
}

In my error service, I managed to get the error message, stacktrace and status code of the error catched by my handleError method, and I want to show a custom error message to my user, depending on the error raised.

My problem, is that I dont know how to identify an error when it is catched by my ErrorHandler. Is there a way to manage that ? Every documentations I found on the subject just copy/paste the error message to the User. The problem is that most of the time, the error is not diggest/comprehensible by the user.

Should I keep using try/catch blocks locally to know where the error was thrown and write the message I want, or is there a way to identify the error (by using a unique error code by error ?).

Is there a good way to manage error handling ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!