Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda