lynx-framework
Version:
lynx is a NodeJS framework for Web Development, based on decorators and the async/await support.
24 lines (23 loc) • 907 B
TypeScript
import { BaseController } from "./base.controller";
import Request from "./request";
import Response from "./response";
/**
* The error controller is a custom controller that is invoked when an error
* occurred.
* It is invoked only on non-API routes (on API routes, the standard API error is used.)
*/
export default class ErrorController extends BaseController {
/**
* This method will be executed when a route is not found (the tipical 404
* error).
* @param req the standard lynx Request
*/
onNotFound(req: Request): Promise<Response>;
/**
* This method will be executed when an error is thrown during the execution
* of a route.
* @param error The error, with an additional "statusCode" property, containing the http status code.
* @param req the standard lynx Request
*/
onError(error: Error, req: Request): Promise<Response>;
}