[SEMVER-MAJOR] Reword log messages for clarity
Before this commit, we logged messages saying "unhandled error". This was often creating confusion for our users, it seems like the error was not handled at all, when in fact it was caught by the configured error handler and converted into a proper HTTP error response. In this commit, I am changing the messaging to use "request failed" instead. While this change is not affecting application developers, it may break tooling processing logs if the tool relies on a specific format of error messages. To be safe, I am labelling this change as breaking. Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
This commit is contained in:
parent
2ef83b945d
commit
7b61bcd541
|
@ -10,12 +10,12 @@ const g = require('strong-globalize')();
|
|||
|
||||
module.exports = function logToConsole(req, err) {
|
||||
if (!Array.isArray(err)) {
|
||||
g.error('Unhandled error for request %s %s: %s',
|
||||
g.error('Request %s %s failed: %s',
|
||||
req.method, req.url, err.stack || err);
|
||||
return;
|
||||
}
|
||||
|
||||
const errMsg = g.f('Unhandled array of errors for request %s %s\n',
|
||||
const errMsg = g.f('Request %s %s failed with multiple errors:\n',
|
||||
req.method, req.url);
|
||||
const errors = err.map(formatError).join('\n');
|
||||
console.error(errMsg, errors);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "strong-error-handler",
|
||||
"description": "Error handler for use in development and production environments.",
|
||||
"license": "MIT",
|
||||
"version": "3.5.0",
|
||||
"version": "4.0.0-1",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue