import { HttpErrorResponse } from '@angular/common/http'; export type ErrorToastMessageGetter> = (error: E, response: HttpErrorResponse) => string; export interface PghErrorDefinitionAction> { buttonName: string; afterClick?: (error: E, response: HttpErrorResponse) => void; } export interface PghErrorDefinition> { condition: { status?: number; pathEndsWith?: string; response?: Partial; custom?: (error: E, response: HttpErrorResponse) => boolean; }; message?: string | ErrorToastMessageGetter; /** * A callback that is called when this error is matched * @param error * @param response */ callback?: (error: E, response: HttpErrorResponse) => void; isHandled: boolean; action?: PghErrorDefinitionAction; } export interface PghErrorHandler> { SERVER_ERRORS: PghErrorDefinition[]; UNHANDLED_ERROR_MESSAGE: string; } export interface PghErrorHandlerResult { isHandled: boolean; message?: string; action?: PghErrorDefinitionAction; }