import * as i2 from '@angular/material/dialog'; import { MatDialogRef } from '@angular/material/dialog'; import { HttpErrorResponse } from '@angular/common/http'; import * as i0 from '@angular/core'; import { ErrorHandler as ErrorHandler$1, InjectionToken } from '@angular/core'; import * as i1 from '@angular/common'; import * as i3 from '@angular/material/button'; /** * Internal HttpError format */ declare class HttpError { readonly error: HttpErrorResponse; status: number; title: string; text: string; actions: Action[]; constructor(error: HttpErrorResponse); } /** * Available properties on dialog actions */ declare class Action { /** * Button label */ label: string; /** * A function to be called based on the given action (e.g window.location.reload to refresh the tab) */ action?: (...args: unknown[]) => unknown; /** * The data to be returned when the dialog is closed. */ closeDialogData?: Record; constructor(label: string); constructor(label: string, close: () => void); constructor(label: string, close: Record); } declare class DialogComponent { readonly data: HttpError; private readonly ref; handleEvent(action: ((...args: any[]) => unknown) | unknown | undefined): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ErrorDialogService { private dialog; private ref; open(err: HttpError): MatDialogRef; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Public interface for the error handler class. */ interface StoErrorHandler { [code: number]: Handler; getErrorText?: (err: HttpErrorResponse) => string; } /** * Internal interface for our errorhandler. */ interface ErrorHandler extends StoErrorHandler, ErrorHandler$1 { handler: (err: HttpErrorResponse, handler?: Handler) => void; handleError: (err: any) => void; defaultHandler: Handler; } /** * Interface for the ErrorLogger injection token. */ interface ErrorLogger { log: (arg0: HttpError) => void; } type Handler = (err: HttpErrorResponse) => HttpError; declare class ErrorHandlerService implements ErrorHandler { private errorDialogService; private customHandler; private logger; /** * Satisfies Angular global ErrorHandler interface * @param err */ handleError(err: any): void; /** * Global handler. This method will try (in order): passed in handler -> custom handler -> default handler for code -> defaultHandler * All errors are passed to a dialog to be displayed there, and will by default have a simple "OK" button to close. * @param err * @param handler */ handler(err: HttpErrorResponse, handler?: Handler): void; defaultHandler(err: HttpErrorResponse): HttpError; [code: number]: Handler; 0(err: HttpErrorResponse): HttpError; 400(err: HttpErrorResponse): HttpError; 401(err: HttpErrorResponse): HttpError; 403(err: HttpErrorResponse): HttpError; 404(err: HttpErrorResponse): HttpError; 409(err: HttpErrorResponse): HttpError; 500(err: HttpErrorResponse): HttpError; 501(err: HttpErrorResponse): HttpError; 503(err: HttpErrorResponse): HttpError; /** * Uses the getErrorText from the provided custom handler, if available. * Otherwise, return the error message, if available in our desired format * Expected err.error -> { message | detail: 'A message', ... } * Also handles text as a fallback. * */ getErrorText(err: HttpErrorResponse): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ErrorHandlerModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare const CUSTOM_ERROR_HANDLER: InjectionToken; declare const ERROR_LOGGER: InjectionToken; export { Action, CUSTOM_ERROR_HANDLER, ERROR_LOGGER, ErrorDialogService, ErrorHandlerModule, ErrorHandlerService, HttpError }; export type { ErrorHandler, ErrorLogger, Handler, StoErrorHandler };