Skip to content

Handle expected Prisma API errors without Sentry noise - #1364

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/OUT-3944-cursor-automated-triage-response-2d91
Closed

Handle expected Prisma API errors without Sentry noise#1364
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/OUT-3944-cursor-automated-triage-response-2d91

Conversation

@cursor

@cursor cursor Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Classify API-boundary errors before deciding whether to log them.
  • Treat expected Prisma P2025 not-found and P2023 malformed-ID/column-data failures as handled 404 responses without console.error.
  • Preserve logging for unclassified Prisma known-request errors and unexpected errors.
  • Added focused regression coverage for handled API/Zod/Copilot/Prisma errors and unexpected logging behavior.

Testing Criteria

  • yarn test src/app/api/tests/utils/withErrorHandler.test.ts --runInBand — 8/8 tests passed, including no-log assertions for API/Zod/Copilot/P2025/P2023 and log assertions for unclassified Prisma/unexpected errors.
  • yarn prettier:check — passed.
  • yarn lint:check — passed with existing React hook/compiler warnings only.
  • yarn test --runInBand — 16/17 suites passed; the remaining src/app/api/tests/utils/authenticate.test.ts suite fails before tests run on the existing Jest/p-retry ESM parse issue (SyntaxError: Cannot use import statement outside a module from node_modules/p-retry/index.js).
  • yarn tsc — still fails on the repo's pre-existing SVG module declaration errors from src/icons/index.ts; no type errors from this change were reported before that baseline failure.

Notes

  • Trigger payload for OUT-3944 was in Triage and has the same Sentry-style title as OUT-3943 (PrismaClientKnownRequestError:). Linear and Sentry MCP servers require authentication in this automation environment, so direct event/project metadata and Linear ticket commenting were unavailable from the agent.
  • Root-cause finding: withErrorHandler was logging before classifying errors, so expected API-boundary Prisma failures (e.g. missing row or malformed UUID route params) could emit console.error and create Sentry noise even though the API returned a handled JSON response.

Impact & Surface Area of Change

  • Shared API route error handling across internal and public API routes that use withErrorHandler.
  • Expected missing-resource/malformed-ID Prisma failures continue returning normalized 404 JSON responses but should no longer create Sentry issues through handled console.error calls.
  • Unexpected errors and unclassified Prisma known-request errors remain logged for Sentry visibility.
Open in Web View Automation 

Co-authored-by: Neil Raina <makeitraina@users.noreply.github.com>
@linear-code

linear-code Bot commented Jul 1, 2026

Copy link
Copy Markdown

OUT-3944

@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tasks-app Ready Ready Preview, Comment Jul 1, 2026 12:22am

Request Review

@priosshrsth priosshrsth closed this Jul 1, 2026
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