Questions tagged [angular-errorhandler]

56 questions
28
votes
3 answers

Http Error Handling in Angular 6

I, am trying to handle the http error using the below class in angular 6. I got a 401 unAuthorized status from server. But however I, don't see the console error message. HttpErrorsHandler.ts file import { ErrorHandler, Injectable} from…
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
8
votes
2 answers

How to limit scope of ErrorHandler?

I have a global error handler defined as such (simplified/proprietary info scrubbed): export class ErrorsHandler extends CommonBase implements ErrorHandler { constructor(protected loggingService: LoggingService, private coreService:…
Kon
  • 27,113
  • 11
  • 60
  • 86
5
votes
1 answer

ErrorHandler & RxJS 6.2.2

I have an application with an globalError handler like this: import { Injectable, ErrorHandler, Injector } from "@angular/core"; import { Router } from "@angular/router"; @Injectable() export class GlobalErrorHandler implements ErrorHandler { …
Wald Specht
  • 81
  • 2
  • 4
4
votes
2 answers

catchError Not working when returning error 500 from web-api

After trying more complex scenarios, without solution I return to basics: I have a web-api controller that when returning error 500, I would like the client to catch it. For some reason - this isn't happening - I probably missing something…
Guy E
  • 1,775
  • 2
  • 27
  • 55
4
votes
0 answers

Silence ExpressionChanged in this particular use case? Not fixing the error but don't display it on the console, stackblitz inside

Related to my question here. and you can find the stackblitz here. I understand why the error shows up and it is indeed correct the fact that it is showing up. Although this is a non-production use case where I want to see the number of change…
SebastianG
  • 8,563
  • 8
  • 47
  • 111
4
votes
1 answer

Angular GlobalErrorHandler and HttpErrorResponse - Resolver throwing badly formatted HttpErrorResponse

I've created global error handler in my Angular 6 application: main error handler method: handleError(error: Error | HttpErrorResponse) { const router = this.injector.get(Router); const notificationService =…
4
votes
2 answers

How to detect if error happened in template in angular?

I am working on global error handler in angular and requirement of my project is also to show a modal window on error, so that user can report if something is wrong and we can fix it. It works fine unless error happens in template. The change…
Blind Despair
  • 3,190
  • 2
  • 20
  • 31
3
votes
1 answer

How to implement a global ErrorHandler along with an HttpInterceptor in Angular?

I found on the web that ErrorHandler can catch all errors as client-side errors and also httpErrorResponse errors. But in my situation, I can catch only client-side errors in GlobalErrorHandlerService, the other one httpErrorResponse can't be…
3
votes
2 answers

Remove error messages from browser console (Angular HttpClient)

Is there a way with the HttpClient to remove error messages from the browser console? My current code looks like this: getStuff(stuffId: string): Observable { return this.httpClient.get(this.stuff() + stuffId +…
3
votes
2 answers

Angular routing exceptions handing in error handler

How to handle navigation errors in ErrorHandler? I tried using the following condition to check whether Error object is of NavigationError but it says false. export class AppErrorHandler implements ErrorHandler { constructor() { } …
Prajwal
  • 3,930
  • 5
  • 24
  • 50
2
votes
1 answer

After call setErrors method in FormControl doesn't show inmediately (Angular Material)

When I call setErrors for a textbox FormControl instance as shown in the images below, there should be an error message immediately but I don't see it until I remove the entire text. Here is my HTML code:
2
votes
1 answer

Is it possible to ignore some errors conditionally, in global error handler of Angular?

I have a situation where I call an API to save data both manually and automatically, In the case of manual save I want to show the error if the save fails, and I achieved this using an angular global error handler. In the case of automatic save I…
Nil
  • 195
  • 3
  • 8
2
votes
1 answer

rxjs error subscription not being triggered

I have a .net Core web-api application. I intentionally return an exception from the controller, but I don't see the exception being treated in the error treatment of the subscription. This is my code (copy by hand, so typos might…
Guy E
  • 1,775
  • 2
  • 27
  • 55
2
votes
1 answer

Angular ErrorHandler and HttpErrorResponse

Today I have decided to look more into some centralized error reporting for my Angular application. I used great article on Medium by Michael Karén…
Jiri Kralovec
  • 1,487
  • 1
  • 10
  • 18
2
votes
0 answers

Angular - ErrorHandler vs HttpInterceptor

I would like to ask if there is any reason for using ErrorHandler and also HttpInterceptor when I want to show a specific error to end user? My question motivation is - I have a project with Angular on frontend and Spring boot for backend and I want…
1
2 3 4