From b5f7c028e26a3ee63820af1f9ababbb58ae82a1d Mon Sep 17 00:00:00 2001 From: Alan Bridgeman Date: Tue, 24 Jun 2025 13:59:14 -0500 Subject: [PATCH] Trying explicitly throwing error to trigger catch clause --- src/decorators/Controller.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/decorators/Controller.ts b/src/decorators/Controller.ts index aba8b91..9e30616 100644 --- a/src/decorators/Controller.ts +++ b/src/decorators/Controller.ts @@ -78,13 +78,14 @@ export function Controller() const path = Reflect.getMetadata(GET_METADATA_KEY, target.prototype, method); // Bind the method to the class instance - app.get(path, async (req, res, next) => { + app.get(path, (req, res, next) => { console.log('[Controller.setup.] Request:', req); console.log('[Controller.setup.] Response:', res); console.log('[Controller.setup.] Next:', next); try { - return await fn.bind(controller)(req, res, next); + fn.bind(controller)(req, res, next) + .catch((error) => { throw new Error(error) }); } catch(error) { console.log('[Controller.setup.] Error:', error);