Closed schmod closed 4 years ago
Yeah I changed that because I didn't like mutation the result object, even if I was confident there wouldn't be a collision...
Are there any other benefits of sub classing Error
other than to work cleaner with some 3rd (4th in this case 😅) party libraries. POJOs are way easier to work with than Error objects plus Error objects are much heavier than celebrate
really needs. Real Error
s include things like stack traces which I don't need.
What if we put a message
property on the root-level Celebrate error? It seems like this could be a middle-ground that does the right thing for many logging/error-handling middlewares that expect "error-like" objects to be passed to next(err)
.
Sentry still wouldn't currently handle this correctly, but I could open an issue with them to see if they'd be open to fixing this on their end.
node
version - 10.xcelebrate
version - 10.0.1joi
version (vianpm ls --depth=0 | grep joi
) - N/ACelebrate 10.0.0 changed the structure and context of the error objects that Celebrate produces (ie. the
err
that Celebrate passes intonext(err)
).This change appears to have broken some 3rd-party error-logging middlewares (specifically sentry) that expect errors passed to
next()
to extend the built-in JSError
object.Would it be possible for
format
to start returning anError
object with a sensiblemessage
property, instead of a plain object?