@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
25 lines (24 loc) • 614 B
TypeScript
export interface DprErrorMessage {
userMessage?: string | string[];
developerMessage?: string | string[];
stack?: string;
moreInfo?: string;
status?: number | string;
}
declare class ErrorHandler {
private readonly error;
constructor(error: unknown);
formatError(): DprErrorMessage;
private handleError;
/**
* Extracts error payload from:
* - direct payload
* - nested payload.data
*/
private extractPayload;
private isSuperAgentError;
private isErrorPayload;
private tryParseJson;
}
export { ErrorHandler };
export default ErrorHandler;