Created
August 25, 2020 09:16
Revisions
-
rgabaydullov created this gist
Aug 25, 2020 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ import { NgModule, Errorhandler } from '@angular/core'; @Injectable export class CustomErrorHandler extends ErrorHandler { handleError(error) { return middlewareErrorHandler(error); } } // ... @NgModule({ providers: [ { provide: ErrorHandler, /* здесь зависит от вашей фантазии, воспользоваться классом или методом */ useValue: customErrorHandler(), useClass: CustomErrorHandler, }, // дополнительно можно встроить обработчики для разных провайдеров по типу HttpService ], });