Skip to main content
Module

x/alosaur/src/http-error/HttpError.ts

Alosaur - Deno web framework with many decorators
Very Popular
Go to Latest
File
/** * Used to throw HTTP errors. * Just do throw new HttpError(code, message) in your controller action and * default error handler will catch it and give in your response given code and message . */export class HttpError extends Error { httpCode: number | undefined = undefined;
constructor(httpCode: number, message?: string) { super(); Object.setPrototypeOf(this, HttpError.prototype);
if (httpCode) { this.httpCode = httpCode; } if (message) { this.message = message; }
this.stack = new Error().stack; }}