Skip to content

Conversation

AikoRamalho
Copy link
Contributor

@AikoRamalho AikoRamalho commented Nov 23, 2023

Closes #20724
This PR enhances error handling in the codebase by including the modelName parameter in the error handling process. This modification ensures better contextual information is available when handling and logging errors during a request.

Changes
Added modelName to the parameters passed in the catch block of the try-catch statement.
Updated the HandleErrorParams interface and modified the handleRequestError method to include the modelName parameter.
Motivation
When an error occurs during a request, having the modelName information at hand can significantly improve the debugging and error resolution process. This update provides more comprehensive details about the context in which an error occurred, enhancing the overall maintainability and troubleshooting capabilities of the code.

@AikoRamalho AikoRamalho requested a review from a team as a code owner November 23, 2023 03:13
@AikoRamalho AikoRamalho requested review from jkomyno and millsp and removed request for a team November 23, 2023 03:13
@AikoRamalho
Copy link
Contributor Author

@SevInf Your thoughts here would be very much appreciated! 😀

@SevInf
Copy link
Contributor

SevInf commented Nov 23, 2023

Thank you @AikoRamalho, overall looks good, left one small comment.
Could you also add a test for this? You can find instructions here. It's ok if you don't have time for that, just let me know and I take it from here.

@janpio janpio changed the title feat(RequestHandler): add modelName to handleAndLogRequestError params feat(RequestHandler): add modelName to handleAndLogRequestError params Nov 23, 2023
@AikoRamalho
Copy link
Contributor Author

an find instructions here. It's ok if you don't have time for that, just let me know and I take it from here.

Working on it!

@AikoRamalho AikoRamalho force-pushed the feat/add-model-info-to-prisma-client-known-request-error branch from 2140e3d to d619e4c Compare November 27, 2023 04:57
@AikoRamalho
Copy link
Contributor Author

AikoRamalho commented Nov 27, 2023

Hey @SevInf !

I created some tests for unique constraint validation errors. However, I haven't tested all possible error codes for PrismaClientKnownError. Let me know your thoughts on the matter, and please inform me if it's necessary to include any tests—I'll implement them here. Thanks for your cooperation! I'm loving contributing to the project!

@AikoRamalho AikoRamalho force-pushed the feat/add-model-info-to-prisma-client-known-request-error branch 4 times, most recently from f11e9cc to 804f774 Compare November 29, 2023 13:35
@AikoRamalho
Copy link
Contributor Author

Hey @janpio!

Your thoughts here would be very much appreciated!

thank you!!!

@AikoRamalho AikoRamalho force-pushed the feat/add-model-info-to-prisma-client-known-request-error branch from 804f774 to 00640de Compare November 30, 2023 15:51
@AikoRamalho AikoRamalho force-pushed the feat/add-model-info-to-prisma-client-known-request-error branch from 00640de to 9b5b64e Compare December 1, 2023 02:14
Copy link
Contributor

@SevInf SevInf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AikoRamalho looks good, thank you and congratulations on the first contribution.

@SevInf SevInf merged commit f0d48d0 into prisma:main Dec 1, 2023
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.

Add model info to PrismaClientKnownRequestError

2 participants