Open paulsouche opened 1 month ago
@morintd could you please take a look at this? I believe it would fix a lot of tests that we currently have to skip because they expect the Prisma call to throw on missing records.
@thw0rted have you seen my workaround in #1082 ?
Yes, thanks @paulsouche -- I'm going to look at adding that, but after posting the above comment I realized that some of my findUniqueOrThrow
calls do throw (just "new Error()", not the more-accurate version from this PR) while some return null instead of throwing. I haven't had a chance to investigate why this is. I probably need to figure out what's going on there first; if I'm actually hitting another bug I'll try to boil it down to a simple repro...
Feel free to fork mine it's already setup
Thanks Paul, the error wound up being a misconfigured mock, but I did run into the other issue you describe here (update
should throw instead of returning null), which I've filed here as #1163, using your starter.
This pull request covers some cases of the #1082
It is not perfect. It covers only
P2025
error codes and the error messages are not the same than the prisma exceptions. As they have some legacy errors, I did not take this into consideration.It introduces a breaking change on
update
as it will now raise an exception instead of returningnull
That's a start. I will have a look if we can easily improve these error messages. Meanwhile, let me know what you think :pray: