Closed swaner closed 3 years ago
fixes #41 .Adding a generic error handler. The idéa is to have a place for handling error logging and also return custom error messages. Ex:
onError: (error, event, context) => { // Global exceptions goes here, works for sns, s3 and sqs should end up here aswell console.log(error) }, proxyIntegration: { onError: (error, request, context) => { // proxy integration exceptions goes here console.log('Error', error, request, context) }, routes: ... } // Also support returning a response: proxyIntegration: { onError: async (error) => { console.log('Error', error) await someAsyncMethod(); return { statusCode: 401, body: Not allowed } }, routes: ... }
fixes #41 .Adding a generic error handler. The idéa is to have a place for handling error logging and also return custom error messages. Ex: