Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

log errors

Carl-Gerhard Lindesvärdb9fe6127fffa
diff --git a/apps/backend/src/middlewares/errors.ts b/apps/backend/src/middlewares/errors.ts
index 48d89cad5..ee7d10f26 100644
--- a/apps/backend/src/middlewares/errors.ts
+++ b/apps/backend/src/middlewares/errors.ts
@@ -4,9 +4,14 @@ import { MixanErrorResponse } from "@mixan/types";
export const errorHandler = (error: HttpError | Error, req: Request, res: Response, next: NextFunction) => {
if(error instanceof HttpError) {
+ console.log('[HttpError]', error.toJson())
return res.status(error.status).json(error.toJson())
}
+ console.log('[UnknownError]', error.name, error.message)
+ if(error.stack) {
+ console.log(error.stack)
+ }
return res.status(500).json({
code: 500,
status: 'error',