lml-main
Version:
This is now a mono repository published into many standalone packages.
26 lines (25 loc) • 675 B
TypeScript
export interface ErrorObject {
message: string;
stack?: string;
[name: string]: any;
status?: number;
}
export interface Success<T> {
success: true;
value: T;
}
export interface Failure {
success: false;
error: ErrorObject;
}
export declare type Result<T> = Success<T> | Failure;
export declare function mkSuccess<T>(value: T): Success<T>;
export declare function mkFailure(error: Error | ErrorObject | string): Failure;
export declare function mkHttpError(error: Error, resp: any, method: string, path: string, params?: any): {
message: string;
path: string;
params: any;
status: any;
method: string;
time: number;
};