From 6031d3a2e672e64992ea9097a7a4551e40e84c38 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sat, 21 Sep 2024 18:39:45 +0200 Subject: [PATCH] app: log all errors (debug) --- src/Application.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Application.ts b/src/Application.ts index 49793f5..9db4fe7 100644 --- a/src/Application.ts +++ b/src/Application.ts @@ -18,7 +18,7 @@ import Extendable, {MissingComponentError} from "./Extendable.js"; import {BadRequestError, HttpError, NotFoundHttpError, ServerError, ServiceUnavailableHttpError} from "./HttpError.js"; import {logger, loggingContextMiddleware} from "./Logger.js"; import SecurityError from "./SecurityError.js"; -import {doesFileExist, Type} from "./Utils.js"; +import {doesFileExist, Type, WrappingError} from "./Utils.js"; import WebSocketListener from "./WebSocketListener.js"; import TemplateError = nunjucks.lib.TemplateError; import AppLocalsCoreComponents from "./components/core/AppLocalsCoreComponents.js"; @@ -145,6 +145,11 @@ export default abstract class Application implements Extendable { if (res.headersSent) return next(err); + logger.debug(err); + if (err instanceof WrappingError) { + logger.debug("-> Caused by", err.cause); + } + // Transform single validation errors into a validation bag for convenience if (err instanceof ValidationError) { const bag = new ValidationBag();