Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(api): improve error logging with structured error object (#1697)

Gergő Móricze06ec2d0478b
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 7e79a49a4..57cb836e5 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -235,25 +235,14 @@ app.use(
}
const id = res.sentry ?? uuidv4();
- let verbose = JSON.stringify(err);
- if (verbose === "{}") {
- if (err instanceof Error) {
- verbose = JSON.stringify({
- message: err.message,
- name: err.name,
- stack: err.stack,
- });
- }
- }
logger.error(
"Error occurred in request! (" +
req.path +
") -- ID " +
id +
- " -- " +
- verbose,
- );
+ " -- ",
+ { error: err });
res.status(500).json({
success: false,
error: