@vaadin/hilla-frontend
Version:
Hilla core frontend utils
90 lines (89 loc) • 2.59 kB
TypeScript
/**
* An exception that gets thrown when the Vaadin backend responds
* with not ok status.
*/
export declare class EndpointError extends Error {
/**
* The optional detail object, containing additional information sent
* from the backend
*/
detail?: unknown;
/**
* The optional name of the exception that was thrown on a backend
*/
type?: string;
/**
* @param message - the `message` property value
* @param type - the `type` property value
* @param detail - the `detail` property value
*/
constructor(message: string, type?: string, detail?: unknown);
}
/**
* An exception that gets thrown if Vaadin endpoint responds
* with non-ok status and provides additional info
* on the validation errors occurred.
*/
export declare class EndpointValidationError extends EndpointError {
/**
* An array of the validation errors.
*/
validationErrorData: ValidationErrorData[];
/**
* An original validation error message.
*/
validationErrorMessage: string;
/**
* @param message - the `message` property value
* @param validationErrorData - the `validationErrorData` property value
* @param type - the `type` property value
*/
constructor(message: string, validationErrorData: ValidationErrorData[], type?: string);
}
/**
* An exception that gets thrown for unexpected HTTP response.
*/
export declare class EndpointResponseError extends EndpointError {
/**
* The optional response object, containing the HTTP response error
*/
response: Response;
/**
* @param message - the `message` property value
* @param response - the `response` property value
*/
constructor(message: string, response: Response);
/**
* Convenience property to get the HTTP code status directly
*/
get status(): number;
}
export declare class UnauthorizedResponseError extends EndpointResponseError {
constructor(message: string, response: Response);
}
export declare class ForbiddenResponseError extends EndpointResponseError {
constructor(message: string, response: Response);
}
/**
* An object, containing all data for the particular validation error.
*/
export declare class ValidationErrorData {
/**
* The validation error message.
*/
message: string;
/**
* The parameter name that caused the validation error.
*/
parameterName?: string;
/**
* Validator original message
*/
validatorMessage?: string;
/**
* @param message - The `message` property value
* @param parameterName - The `parameterName` property value
* @param validatorMessage - The `validatorMessage` property value
*/
constructor(message: string, parameterName?: string, validatorMessage?: string);
}