You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 10, 2024. It is now read-only.
When the data validation fails the error description gets returned in the response body. I need a way to also log the response. Currently my error handler gets executed only for 5xx errors. This is the code I'm using:
osprey.loadFile(path).then(middleware=>{constapp=express()app.use(middleware,router)app.use((err,req,res,next)=>{constmessage=`REQUEST\n=======\n\n${JSON.stringify(req.body)}\n\nERROR\n=====\n\n${err.stack}`console.error(message)res.status(500).send(`REQUEST\n=======\n\n${req.body}\n\nERROR\n=====\n\n${err.stack}`)})app.listen(PORT,()=>{console.log(`Server listening on port ${PORT}`)})}).catch(e=>console.error("Error: %s",e.message))
The text was updated successfully, but these errors were encountered:
When the data validation fails the error description gets returned in the response body. I need a way to also log the response. Currently my error handler gets executed only for
5xx
errors. This is the code I'm using:The text was updated successfully, but these errors were encountered: