@@ -29,16 +29,16 @@ const checkPatchOverrideSupport = function (req, res) {
2929 * REST is all about communication. The response code and the textual body are particular.
3030 * RERUM is all about being clear. It will build custom responses sometimes for certain scenarios, will remaining RESTful.
3131 *
32- * Note that the res upstream from this has been converted into err. res will not have what you are looking for, check err instead.
32+ * You have likely reached this with a next(createExpressError( err)) call . End here and send the error.
3333 */
3434const messenger = function ( err , req , res , next ) {
3535 if ( res . headersSent ) {
3636 next ( err )
3737 return
3838 }
3939 let error = { }
40- error . message = err . statusMessage ?? err . message ?? res . statusMessage ?? res . message ?? ``
41- error . status = err . statusCode ?? res . statusCode ?? 500
40+ error . message = err . statusMessage ?? err . message ?? ``
41+ error . status = err . statusCode ?? 500
4242 if ( error . status === 401 ) {
4343 //Special handler for token errors from the oauth module
4444 //Token errors come through with a message that we want. That message is in the error's WWW-Authenticate header
@@ -47,7 +47,6 @@ const messenger = function (err, req, res, next) {
4747 error . message += err . headers [ "WWW-Authenticate" ]
4848 }
4949 }
50- let genericMessage = ""
5150 let token = req . header ( "Authorization" )
5251 if ( token && ! token . startsWith ( "Bearer " ) ) {
5352 error . message += `
@@ -96,7 +95,7 @@ The requested web page or resource could not be found.`
9695 // These are all handled in api-routes.js already.
9796 break
9897 case 409 :
99- // These are all handled in db-controller createExpressError() already.
98+ // These are all handled in db-controller.js already.
10099 break
101100 case 503 :
102101 //RERUM is down or readonly. Handled upstream.
0 commit comments