@lucaapp/service-utils 5.34.0 → 5.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/api/endpoint.js +6 -0
- package/package.json +1 -1
package/dist/lib/api/endpoint.js
CHANGED
|
@@ -110,6 +110,12 @@ const sendErrorResponse = (response, error, knownErrors, debug) => {
|
|
|
110
110
|
sendKnownErrorResponse(response, statusCode, error, debug);
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
+
if (isTypedError(error)) {
|
|
114
|
+
// The service knew what went wrong and named it; the route just never said
|
|
115
|
+
// what to answer. Without this line that is a silent 500, and the only way
|
|
116
|
+
// anyone finds one is a 5xx alert days later.
|
|
117
|
+
response.log?.warn({ errorType: error.type, url: response.req?.originalUrl }, 'Typed error is not declared on this route, answering 500');
|
|
118
|
+
}
|
|
113
119
|
sendUnknownErrorResponse(response, error, debug);
|
|
114
120
|
return;
|
|
115
121
|
};
|