UNPKG

@httpc/kit

Version:

httpc toolbox for building function-based API with minimal code and end-to-end type safety

15 lines (14 loc) 895 B
import { HttpCallError } from "@httpc/server"; import { ServiceError } from "./error"; export declare function catchError(error: string | { new (): Error; }): () => Promise<undefined>; export declare function catchError<T>(error: string | { new (): Error; }, func: (err: Error) => T): () => Promise<T>; export declare function catchNotFound<T>(func: (err: ServiceError) => T): (err: any) => T; export declare function catchNotFoundThrows(error: () => HttpCallError): (err: any) => never; export declare function catchNotFoundThrowUnauthorized(message?: string): (err: any) => never; export declare function catchNotFoundThrowForbidden(message?: string): (err: any) => never; export declare function catchNotFoundThrowNotFound(message?: string): (err: any) => never; export declare function catchLogAndThrowUnauthorized(log?: string, message?: string): (err: any) => never;