/** * HTTP Error classes for webpieces-ts. * These errors are used throughout the framework for consistent error handling. */ /** * ProtocolError - Data class for error response body. * This is what gets serialized and sent to the client. */ export declare class ProtocolError { message?: string; subType?: string; field?: string; waitSeconds?: number; name?: string; guiAlertMessage?: string; errorCode?: string; } /** * HttpError - Base error class with HTTP status code. * All specific HTTP errors extend this class. */ export declare class HttpError extends Error { code: number; subType?: string; readonly httpCause?: Error; constructor(message: string, code: number, subType?: string, cause?: Error); } export declare const ENTITY_NOT_FOUND = "EntityNotFoundError"; export declare const WRONG_LOGIN_TYPE = "wrongLoginType"; export declare const WRONG_LOGIN = "wronglogin"; export declare const NOT_APPROVED = "notapproved"; export declare const EMAIL_NOT_CONFIRMED = "email_not_confirmed"; export declare const WRONG_DOMAIN = "wrongdomain"; export declare const WRONG_COMPANY = "wrongcompany"; export declare const NO_REG_CODE = "noregcode"; /** * HttpNotFoundError - 404 Not Found. */ export declare class HttpNotFoundError extends HttpError { constructor(message: string, cause?: Error); } /** * EndpointNotFoundError - 404 for missing endpoints. */ export declare class EndpointNotFoundError extends HttpNotFoundError { constructor(message: string, cause?: Error); } /** * HttpBadRequestError - 400 Bad Request. * Used for validation errors with optional field and GUI message. */ export declare class HttpBadRequestError extends HttpError { field?: string; guiMessage?: string; constructor(message: string, field?: string, guiMessage?: string, cause?: Error); } /** * HttpUnauthorizedError - 401 Unauthorized. */ export declare class HttpUnauthorizedError extends HttpError { constructor(message: string, subType?: string, cause?: Error); } /** * HttpForbiddenError - 403 Forbidden. */ export declare class HttpForbiddenError extends HttpError { constructor(message: string, cause?: Error); } /** * HttpTimeoutError - 408 Request Timeout. */ export declare class HttpTimeoutError extends HttpError { constructor(message: string, cause?: Error); } /** * HttpBadGatewayError - 502 Bad Gateway. */ export declare class HttpBadGatewayError extends HttpError { constructor(message: string, cause?: Error); } /** * HttpGatewayTimeoutError - 504 Gateway Timeout. * SHOULD NOT BE USED SERVER SIDE SINCE ALBs will return 504 and it will not be translated * to json body 'ProtocolError'. */ export declare class HttpGatewayTimeoutError extends HttpError { constructor(message: string, cause?: Error); } /** * HttpInternalServerError - 500 Internal Server Error. */ export declare class HttpInternalServerError extends HttpError { constructor(message: string, cause?: Error); } /** * HttpVendorError - 598 Vendor Error. * Custom status code for vendor/external service errors with retry hint. */ export declare class HttpVendorError extends HttpError { waitSeconds: number; constructor(message: string, waitSeconds?: number, cause?: Error); } /** * HttpUserError - User validation error with 2xx status code. * * Uses HTTP 266 (non-standard 2xx code) intentionally because: * 1. User validation errors are "successful" from server perspective - user just made a mistake * 2. Browser DevTools show 4xx/5xx codes in RED, which is confusing for user validation * 3. Allows error to propagate up the stack via throw without triggering error monitoring * 4. Avoids polluting logs with "errors" that are actually expected user behavior * * This is a deliberate design pattern - do NOT change to 4xx codes. * Examples: "Email already exists", "Invalid password format", "Required field missing" */ export declare class HttpUserError extends HttpError { errorCode?: string; constructor(message: string, errorCode?: string, cause?: Error); }