Closed tataihono closed 3 months ago
Attention: Patch coverage is 85.71429%
with 1 line
in your changes missing coverage. Please review.
Project coverage is 91.84%. Comparing base (
cf2f1f2
) to head (cd606b8
). Report is 601 commits behind head on main.
Files with missing lines | Patch % | Lines |
---|---|---|
apps/api-media/src/schema/video/video.ts | 85.71% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I see you added the "on stage" label, I'll get this merged to the stage branch!
This pull request introduces error handling for cases where a video is not found in the database. The changes include importing necessary libraries, adding error handling in the video query resolver, and updating tests to cover the new error scenario.
Error handling improvements:
apps/api-media/src/schema/video/video.ts
: Added error handling in the video query resolver to throw aGraphQLError
when a video is not found. This involves catchingPrismaClientKnownRequestError
and rethrowing it as aGraphQLError
with a specific message. [1] [2]Testing enhancements:
apps/api-media/src/schema/video/video.spec.ts
: Added a test case to ensure that aGraphQLError
is thrown when a video is not found. This includes mocking theprisma.video.findFirstOrThrow
method to simulate the error scenario.Library imports:
apps/api-media/src/schema/video/video.ts
: ImportedGraphQLError
fromgraphql
andPrisma
from the Prisma client to support the new error handling logic.apps/api-media/src/schema/video/video.spec.ts
: ImportedGraphQLError
fromgraphql
to use in the new test case.