@fal-ai/serverless-client
Version:
Deprecation note: this library has been deprecated in favor of @fal-ai/client
23 lines (22 loc) • 765 B
TypeScript
import { ValidationErrorInfo } from "./types";
export type ResponseHandler<Output> = (response: Response) => Promise<Output>;
type ApiErrorArgs = {
message: string;
status: number;
body?: any;
};
export declare class ApiError<Body> extends Error {
readonly status: number;
readonly body: Body;
constructor({ message, status, body }: ApiErrorArgs);
}
type ValidationErrorBody = {
detail: ValidationErrorInfo[];
};
export declare class ValidationError extends ApiError<ValidationErrorBody> {
constructor(args: ApiErrorArgs);
get fieldErrors(): ValidationErrorInfo[];
getFieldErrors(field: string): ValidationErrorInfo[];
}
export declare function defaultResponseHandler<Output>(response: Response): Promise<Output>;
export {};