fix: use pino err key for proper Error serialization in controllers
Error objects logged as { error } were serialized as {} because pino
only applies its error serializer to the err key.
This commit is contained in:
@@ -28,7 +28,7 @@ export class ChatController {
|
||||
res.json(response);
|
||||
} catch (error) {
|
||||
log.error(
|
||||
{ error, userId: req.user?.userId },
|
||||
{ err: error, userId: req.user?.userId },
|
||||
"Error processing message",
|
||||
);
|
||||
res.status(500).json({ error: "Failed to process message" });
|
||||
@@ -79,13 +79,13 @@ export class ChatController {
|
||||
await this.caldavService.pushAll(userId);
|
||||
}
|
||||
} catch (error) {
|
||||
log.error({ error, userId }, "CalDAV push after confirm failed");
|
||||
log.error({ err: error, userId }, "CalDAV push after confirm failed");
|
||||
}
|
||||
|
||||
res.json(response);
|
||||
} catch (error) {
|
||||
log.error(
|
||||
{ error, conversationId: req.params.conversationId },
|
||||
{ err: error, conversationId: req.params.conversationId },
|
||||
"Error confirming event",
|
||||
);
|
||||
res.status(500).json({ error: "Failed to confirm event" });
|
||||
@@ -106,7 +106,7 @@ export class ChatController {
|
||||
res.json(response);
|
||||
} catch (error) {
|
||||
log.error(
|
||||
{ error, conversationId: req.params.conversationId },
|
||||
{ err: error, conversationId: req.params.conversationId },
|
||||
"Error rejecting event",
|
||||
);
|
||||
res.status(500).json({ error: "Failed to reject event" });
|
||||
@@ -123,7 +123,7 @@ export class ChatController {
|
||||
res.json(conversations);
|
||||
} catch (error) {
|
||||
log.error(
|
||||
{ error, userId: req.user?.userId },
|
||||
{ err: error, userId: req.user?.userId },
|
||||
"Error getting conversations",
|
||||
);
|
||||
res.status(500).json({ error: "Failed to get conversations" });
|
||||
@@ -157,7 +157,7 @@ export class ChatController {
|
||||
res.status(404).json({ error: "Conversation not found" });
|
||||
} else {
|
||||
log.error(
|
||||
{ error, conversationId: req.params.id },
|
||||
{ err: error, conversationId: req.params.id },
|
||||
"Error getting conversation",
|
||||
);
|
||||
res.status(500).json({ error: "Failed to get conversation" });
|
||||
@@ -187,7 +187,7 @@ export class ChatController {
|
||||
}
|
||||
} catch (error) {
|
||||
log.error(
|
||||
{ error, messageId: req.params.messageId },
|
||||
{ err: error, messageId: req.params.messageId },
|
||||
"Error updating proposal event",
|
||||
);
|
||||
res.status(500).json({ error: "Failed to update proposal event" });
|
||||
|
||||
Reference in New Issue
Block a user