From b357cf3f8f6f4ad5b8777ee4941b0435903d1153 Mon Sep 17 00:00:00 2001 From: Alan Bridgeman Date: Tue, 24 Jun 2025 13:37:18 -0500 Subject: [PATCH] Added more stuff for debugging to figure out what is happening --- src/decorators/Controller.ts | 4 ++++ src/decorators/Page.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/decorators/Controller.ts b/src/decorators/Controller.ts index 8af64b3..aba8b91 100644 --- a/src/decorators/Controller.ts +++ b/src/decorators/Controller.ts @@ -87,11 +87,15 @@ export function Controller() return await fn.bind(controller)(req, res, next); } catch(error) { + console.log('[Controller.setup.] Error:', error); if(typeof next !== 'undefined') { + console.log('[Controller.setup.] Calling next with error:', error); next(error); return; } else { + console.log('[Controller.setup.] No next function defined, rejecting promise with error:', error); + // Because next is undefined and we still want to have Express handle the error we reject the promise return Promise.reject(error); } diff --git a/src/decorators/Page.ts b/src/decorators/Page.ts index b6c3c6d..27f02bf 100644 --- a/src/decorators/Page.ts +++ b/src/decorators/Page.ts @@ -158,10 +158,14 @@ export function Page(title: string, page: string, extraScripts: (string | { scri catch(error) { console.error('[Page Decorator] Error:', error); if(typeof next !== 'undefined') { + console.log('[Page Decorator] Calling next with error:', error); + next(error); return; } else { + console.log('[Page Decorator] No next function defined, rejecting promise with error:', error); + // Because next is undefined and we still want to have Express handle the error we reject the promise return Promise.reject(error); }