@riddance/service
Version:
28 lines (27 loc) • 921 B
TypeScript
import { Context, Json } from './context.js';
export * from '@riddance/host/lib/http';
export * from './context.js';
export declare function withStatus(error: Error, status: number): Error & {
statusCode: number;
};
export declare function withPublicMessage(error: Error, message?: string): Error;
export declare function badRequest(publicMessage?: string): Error;
/** Please authenticate yourself, e.g. log in or refresh your tokens. */
export declare function unauthorized(): Error & {
statusCode: number;
};
/** I known who you are; you're never getting in. */
export declare function forbidden(): Error & {
statusCode: number;
};
export declare function notFound(): Error & {
statusCode: number;
};
export declare function notImplemented(): Error & {
statusCode: number;
};
export declare function getBearer(context: Context, req: {
headers: {
authorization?: string;
};
}): Json;