Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return relevant error code in logger interceptor #2245

Merged
merged 2 commits into from
Jan 10, 2025
Merged

Conversation

PooyaRaki
Copy link
Contributor

@PooyaRaki PooyaRaki commented Jan 7, 2025

Summary

his PR ensures that the correct status codes are returned and logged. Previously, an incorrect status code might have been recorded in the logs, which could lead to confusion or misinterpretation during debugging or monitoring.
This change improves the reliability and accuracy of application logs, aiding in better diagnostics and monitoring.

When we call the parse method from Zod we cannot convert the errors to ZodErrorWithCode easily so we need to catch these errors and return the relevant error code in the interceptor

Changes

Updated the logic to accurately capture and log the status codes returned by the application.

@PooyaRaki PooyaRaki marked this pull request as ready for review January 8, 2025 11:07
@PooyaRaki PooyaRaki requested a review from a team as a code owner January 8, 2025 11:07
@PooyaRaki PooyaRaki merged commit c5dd9eb into main Jan 10, 2025
20 checks passed
@PooyaRaki PooyaRaki deleted the loggerErrorCode branch January 10, 2025 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants