Spreadsheet-UX op een echte relationele engine
Deze repository wordt als momentopname gepubliceerd: een clone bevat de volledige inhoud, maar geen commitgeschiedenis.
export class HttpError extends Error {
constructor(
readonly status: number,
readonly code: string,
message: string,
readonly details?: unknown,
) {
super(message);
this.name = 'HttpError';
}
}
export const badRequest = (message: string, details?: unknown) =>
new HttpError(400, 'bad_request', message, details);
export const unauthorized = (message = 'Sign in to continue.') =>
new HttpError(401, 'unauthorized', message);
export const forbidden = (message = 'You do not have permission to do that.') =>
new HttpError(403, 'forbidden', message);
export const notFound = (message: string) => new HttpError(404, 'not_found', message);
export const conflict = (message: string) => new HttpError(409, 'conflict', message);
export const tooManyRequests = (message: string) => new HttpError(429, 'too_many_requests', message);