Skip to content

Commit 892f353

Browse files
committed
polish
1 parent 95ef3f5 commit 892f353

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ app.use('/app/update', updateRouter)
6969
app.use('/app/delete', deleteRouter)
7070
app.use('/app/overwrite', overwriteRouter)
7171

72-
// RERUM error response handler, and app 404s
72+
// RERUM error response handler, as well as unhandled generic app error handler
7373
app.use(messenger)
7474

7575
export default app

error-messenger.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Errors from RERUM are a response code with a text body (except those handled specifically upstream)
33
* We want to send the same error and message through. It is assumed to be RESTful and useful.
4-
* This will also handle app level 404 errors.
4+
* This will also handle generic (500) app level errors, as well as app level 404 errors.
55
*
66
* @param rerum_error_res A Fetch API Response object from a fetch() to RERUM that encountered an error. Explanatory text is in .text().
77
* @param req The Express Request object from the request into TinyNode
@@ -22,6 +22,7 @@ export async function messenger(rerum_error_res, req, res, next) {
2222
}
2323
if (rerum_err_text) error.message = rerum_err_text
2424
else {
25+
// Perhaps this is a more generic 500 from the app and there is no good rerum_error_res
2526
error.message = rerum_error_res.statusMessage ?? rerum_error_res.message ?? `An unhandled error occured, perhaps with RERUM.`
2627
}
2728
error.status = rerum_error_res.statusCode ?? rerum_error_res.status ?? 500

0 commit comments

Comments
 (0)