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();