Trying explicitly throwing error to trigger catch clause
All checks were successful
Publish to Private NPM Registry / publish (push) Successful in 31s
All checks were successful
Publish to Private NPM Registry / publish (push) Successful in 31s
This commit is contained in:
parent
6cb8ce72ad
commit
b5f7c028e2
1 changed files with 3 additions and 2 deletions
|
|
@ -78,13 +78,14 @@ export function Controller<T extends { new (...args: any[]): BaseController }>()
|
|||
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.<GET request>] Request:', req);
|
||||
console.log('[Controller.setup.<GET request>] Response:', res);
|
||||
console.log('[Controller.setup.<GET request>] 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.<GET request>] Error:', error);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue