Trying explicitly throwing error to trigger catch clause
All checks were successful
Publish to Private NPM Registry / publish (push) Successful in 31s

This commit is contained in:
Alan Bridgeman 2025-06-24 13:59:14 -05:00
parent 6cb8ce72ad
commit b5f7c028e2

View file

@ -78,13 +78,14 @@ export function Controller<T extends { new (...args: any[]): BaseController }>()
const path = Reflect.getMetadata(GET_METADATA_KEY, target.prototype, method); const path = Reflect.getMetadata(GET_METADATA_KEY, target.prototype, method);
// Bind the method to the class instance // Bind the method to the class instance
app.get(path, async (req, res, next) => { app.get(path, (req, res, next) => {
console.log('[Controller.setup.<GET request>] Request:', req); console.log('[Controller.setup.<GET request>] Request:', req);
console.log('[Controller.setup.<GET request>] Response:', res); console.log('[Controller.setup.<GET request>] Response:', res);
console.log('[Controller.setup.<GET request>] Next:', next); console.log('[Controller.setup.<GET request>] Next:', next);
try { try {
return await fn.bind(controller)(req, res, next); fn.bind(controller)(req, res, next)
.catch((error) => { throw new Error(error) });
} }
catch(error) { catch(error) {
console.log('[Controller.setup.<GET request>] Error:', error); console.log('[Controller.setup.<GET request>] Error:', error);