dx: report stack over http in case of uncaught exception
Massimo Melina committed
Jan 6, 2024 at 17:25 UTC
0dd2d16b52555f87e9939e26b1da2e81533845e8
1 file changed
+1
-1
src/apiMiddleware.ts
+1
-1
@@ -66,7 +66,7 @@ export function apiMiddleware(apis: ApiHandlers) : Koa.Middleware {
66
if (res instanceof ApiError)
67
return send(res.status, res.message)
68
if (res instanceof Error) // generic error/exception
69
- return send(HTTP_BAD_REQUEST, res.message || String(res))
69
+ return send(HTTP_BAD_REQUEST, res.stack || res.message || String(res))
70
ctx.body = res
71
72
function send(status: number, body?: string) {