Skip to content

Commit d1a61dc

Browse files
committed
fix: update error handling to use correct error message in details
1 parent 57fcf46 commit d1a61dc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

backend/src/middleware/errorHandler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export function errorHandler(
2929
return;
3030
}
3131

32-
const details = isProduction() ? undefined : { cause: message || "unknown" };
32+
const details = isProduction()
33+
? undefined
34+
: { cause: error.message || "unknown" };
35+
const appError = AppError.internal("Erro interno.", details);
3336
res.status(appError.statusCode).json(appError.toJSON());
3437
}

0 commit comments

Comments
 (0)