added stack trace to some logging

This commit is contained in:
jackiettran
2025-12-25 18:41:42 -05:00
parent b02ec19d5c
commit 76e4039ba8
15 changed files with 307 additions and 173 deletions

View File

@@ -311,6 +311,7 @@ router.post('/posts', authenticateToken, async (req, res, next) => {
const reqLogger = logger.withRequestId(req.id);
reqLogger.error("Geocoding failed for item request", {
error: error.message,
stack: error.stack,
zipCode
});
// Continue without coordinates - post will still be created
@@ -450,6 +451,7 @@ router.post('/posts', authenticateToken, async (req, res, next) => {
} catch (emailError) {
logger.error("Failed to send item request notification", {
error: emailError.message,
stack: emailError.stack,
recipientId: user.id,
postId: post.id
});
@@ -1383,7 +1385,12 @@ router.delete('/admin/posts/:id', authenticateToken, requireAdmin, async (req, r
}
} catch (emailError) {
// Log but don't fail the deletion
console.error('Failed to send forum post deletion notification email:', emailError.message);
logger.error('Failed to send forum post deletion notification email', {
error: emailError.message,
stack: emailError.stack,
postId: post.id,
authorId: post.authorId
});
}
})();
@@ -1511,7 +1518,12 @@ router.delete('/admin/comments/:id', authenticateToken, requireAdmin, async (req
}
} catch (emailError) {
// Log but don't fail the deletion
console.error('Failed to send forum comment deletion notification email:', emailError.message);
logger.error('Failed to send forum comment deletion notification email', {
error: emailError.message,
stack: emailError.stack,
commentId: comment.id,
authorId: comment.authorId
});
}
})();