diff --git a/projects/nshmp-apps/src/main.ts b/projects/nshmp-apps/src/main.ts index 2c37f0ca79563f79857fb8e56e0a8753d4d1df1f..4f81ffd98a32167fd0b446282440e792aab03267 100644 --- a/projects/nshmp-apps/src/main.ts +++ b/projects/nshmp-apps/src/main.ts @@ -7,7 +7,7 @@ import {provideRouter} from '@angular/router'; import {AppComponent} from './app/app.component'; import {appRoutes} from './app/app.routes'; import {environment} from './environments/environment'; -import {tooManyRequestsInterceptor} from './shared/interceptors/too-many-requests.interceptor'; +import {httpErrorInterceptor} from './shared/interceptors/http-error.interceptor'; if (environment.production) { enableProdMode(); @@ -18,6 +18,6 @@ bootstrapApplication(AppComponent, { importProvidersFrom(BrowserModule), provideRouter(appRoutes()), provideAnimations(), - provideHttpClient(withInterceptors([tooManyRequestsInterceptor])), + provideHttpClient(withInterceptors([httpErrorInterceptor])), ], }).catch(err => console.error(err)); diff --git a/projects/nshmp-apps/src/shared/interceptors/too-many-requests.interceptor.ts b/projects/nshmp-apps/src/shared/interceptors/http-error.interceptor.ts similarity index 81% rename from projects/nshmp-apps/src/shared/interceptors/too-many-requests.interceptor.ts rename to projects/nshmp-apps/src/shared/interceptors/http-error.interceptor.ts index 1e0920f519f151af27d8aa16943861bc3d1dc8f5..100340041bf0f9e5a0d7b3a1e64008424fcfc8cd 100644 --- a/projects/nshmp-apps/src/shared/interceptors/too-many-requests.interceptor.ts +++ b/projects/nshmp-apps/src/shared/interceptors/http-error.interceptor.ts @@ -6,17 +6,14 @@ import { } from '@angular/common/http'; import {catchError, Observable} from 'rxjs'; -export function tooManyRequestsInterceptor( +export function httpErrorInterceptor( req: HttpRequest<unknown>, next: HttpHandlerFn ): Observable<HttpEvent<unknown>> { return next(req).pipe( catchError(error => { - console.log(error); - if (error instanceof HttpErrorResponse) { if (typeof error.error === 'string') { - console.log('is string'); throw new Error(error.error); } }