import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; import { Router } from '@angular/router'; import { BaseUserService } from '@mtna/lib-ui/base-user-service'; import { MtnaLogger } from '@mtna/lib-ui/logger'; import { Observable } from 'rxjs'; import { ErrorMessageDetails } from './error-message-details.model'; import * as i0 from "@angular/core"; /** * This error interceptor is a basic error interceptor to be used with applications where user authentication is not * implemented. This will provide a pleasing display of error messages should there be errors that are encountered in * the application. If a 401 is encountered, the user service will be used to push someone to login which could be * useful if there is a single static management account or something like that, but it will not handle things like * forcing users to change passwords, agree to end user license agreements, etc. If those functionalities are desired, * the MtnaAuthErrorInterceptor from auth-ui should be used. * * The different handlers that are defined here are meant to be used and overridden to give subclasses the flexibility * to handle the errors as they see fit. Each handler will return a ErrorMessageDetail or `false`. This allows the * handler to specify that they have handled the error in a satisfactory way and no error message should be presented to * the user, in which case EMPTY will be returned by the intercept method. */ export declare class MtnaErrorInterceptor implements HttpInterceptor { protected logger: MtnaLogger; protected router: Router; protected userService: BaseUserService; protected defaultTitle: string; protected defaultMessage: string; constructor(logger: MtnaLogger, router: Router, userService: BaseUserService); intercept(req: HttpRequest, next: HttpHandler): Observable>; /** * Handles status code 0, which is not a true http code but typically indicates an aborted request. * @param response the HttpErrorResponse * @return the ErrorMessageDetails to present to the user or `false` if the error has been handled and no message should * be presented to the user * @protected */ protected handleAborted(response: HttpErrorResponse): ErrorMessageDetails | false; /** * Handles status code 400 * @param response the HttpErrorResponse * @return the ErrorMessageDetails to present to the user or `false` if the error has been handled and no message should * be presented to the user * @protected */ protected handleBadRequest(response: HttpErrorResponse): ErrorMessageDetails | false; /** * Handles status code 401 * @param response the HttpErrorResponse * @return the ErrorMessageDetails to present to the user or `false` if the error has been handled and no message should * be presented to the user * @protected */ protected handleUnauthorized(response: HttpErrorResponse): ErrorMessageDetails | false; /** * Handles status code 403 * @param response the HttpErrorResponse * @return the ErrorMessageDetails to present to the user or `false` if the error has been handled and no message should * be presented to the user * @protected */ protected handleForbidden(response: HttpErrorResponse): ErrorMessageDetails | false; /** * Handles status code 404 * @param response the HttpErrorResponse * @return the ErrorMessageDetails to present to the user or `false` if the error has been handled and no message should * be presented to the user * @protected */ protected handleNotFound(response: HttpErrorResponse): ErrorMessageDetails | false; /** * Handles status code 412 * @param response the HttpErrorResponse * @return the ErrorMessageDetails to present to the user or `false` if the error has been handled and no message should * be presented to the user * @protected */ protected handlePreconditionFailed(response: HttpErrorResponse): ErrorMessageDetails | false; /** * Handles status code 500 * @param response the HttpErrorResponse * @return the ErrorMessageDetails to present to the user or `false` if the error has been handled and no message should * be presented to the user * @protected */ protected handleServerError(response: HttpErrorResponse): ErrorMessageDetails | false; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export declare class MtnaErrorInterceptorModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; }