-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Currently, in the Routes implementation, we have the following code as an example
serviceRouter.post('/', (req, res, next) => {
logger.info('Service post message received');
try {
post(req, res);
} catch (error) {
next(error);
}
});The post function being called is usually an async function, therefore if an error occurs during its execution, we won't be able to catch those errors in the catch method as it is.
Therefore I suggest we modify the code to catch async errors like this
serviceRouter.post('/', async (req, res, next) => {
logger.info('Service post message received');
try {
await post(req, res);
} catch (error) {
next(error);
}
});This change needs to be implemented for all connect applications and both for js and ts code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels