@tinyhttp/app
Advanced tools
Comparing version 2.0.24 to 2.0.25
@@ -49,3 +49,5 @@ import { STATUS_CODES, createServer } from "http"; | ||
}; | ||
const onErrorHandler = (err, _req, res) => { | ||
const onErrorHandler = function(err, _req, res) { | ||
if (this.onError === onErrorHandler && this.parent) | ||
return this.parent.onError(err, _req, res); | ||
if (!process.env.TESTING && err instanceof Error) | ||
@@ -140,3 +142,3 @@ console.error(err); | ||
this.onError = (options == null ? void 0 : options.onError) || onErrorHandler; | ||
this.noMatchHandler = (options == null ? void 0 : options.noMatchHandler) || this.onError.bind(null, { code: 404 }); | ||
this.noMatchHandler = (options == null ? void 0 : options.noMatchHandler) || this.onError.bind(this, { code: 404 }); | ||
this.settings = options.settings || { xPoweredBy: true, views: process.cwd() }; | ||
@@ -143,0 +145,0 @@ this.applyExtensions = options == null ? void 0 : options.applyExtensions; |
import type { NextFunction } from '@tinyhttp/router'; | ||
import type { Request } from './request.js'; | ||
import type { Response } from './response.js'; | ||
export declare type ErrorHandler = (err: any, req: Request, res: Response, next?: NextFunction) => void; | ||
import type { App } from './app'; | ||
export declare type ErrorHandler = (this: App, err: any, req: Request, res: Response, next?: NextFunction) => void; | ||
export declare const onErrorHandler: ErrorHandler; |
{ | ||
"name": "@tinyhttp/app", | ||
"version": "2.0.24", | ||
"version": "2.0.25", | ||
"description": "0-legacy, tiny & fast web framework as a replacement of Express", | ||
@@ -5,0 +5,0 @@ "type": "module", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23632
549