In Angular For Every Error on Html and TS and Module Error it is showing same error Details

1k views Asked by At

in Angular Project i am using Angular 5 with .Net MVC. for Ts error, Module Level Error and Even for HTML syntax error also it is Displaying same error. its getting Difficult to Handle. please Help me.

TypeError: exceptionHandler.handleError is not a function
at Object.next (core.js:5493)
at SafeSubscriber.schedulerFn [as _next] (core.js:4327`enter code here`)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:239)
at SafeSubscriber.next (Subscriber.js:186)
at Subscriber._next (Subscriber.js:126)
at Subscriber.next (Subscriber.js:90)
at EventEmitter.Subject.next (Subject.js:55)
at EventEmitter.emit (core.js:4307)
at core.js:4767
at ZoneDelegate.invoke (zone.js:388)
2

There are 2 answers

0
Raja Mohamed On BEST ANSWER

Seems you have custom exception handler in your code. 1. In case its not really required remove from code.

import { ErrorHandler } from '@angular/core';

remove this import and dependent code from your project.

  1. In case its required then, double check the exception handler class

    import { ErrorHandler } from '@angular/core';
    
    export default class MyErrorHandler implements ErrorHandler {
        constructor() { 
    
            super(true);
        }
    
        handleError(error) {
    
            super.handleError(error); 
        }
    }
    
    
    
    
    
    
    import { NgModule, ErrorHandler } from '@angular/core';
    import MyErrorHandler from './my-error-handler';
    
    @NgModule({
            imports: [ BrowserModule ],
            declarations: [ App ],
            providers: [ { provide: ErrorHandler, useClass: MyErrorHandler } ]
            bootstrap: [ App ]
    })
    export class AppModule {}
    
0
Oleksandr Poshtaruk On
  1. Check if you re-assigned global exception handler in your angular project like in thi article https://medium.com/@amcdnl/global-error-handling-with-angular2-6b992bdfb59c. And fix it or turn it off. Search the project for 'handleError'.

  2. Check same for JS level https://www.tutorialspoint.com/How-to-write-a-global-error-handler-in-JavaScript