Skip to content

Handle JsonSchemaRequestException as 400 Bad Request in ThrowableHandler - #189

Open
koriym wants to merge 1 commit into
1.xfrom
feature/json-schema-exception-handler
Open

Handle JsonSchemaRequestException as 400 Bad Request in ThrowableHandler#189
koriym wants to merge 1 commit into
1.xfrom
feature/json-schema-exception-handler

Conversation

@koriym

@koriym koriym commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Raise bear/resource requirement from ^1.16 to ^1.33
  • In ThrowableHandler::handle(), convert JsonSchemaRequestException to BadRequestException (code 400) so VndError emits the correct 4xx response instead of the generic 500
  • JsonSchemaResponseException (server-side schema mismatch) continues to produce a 500 — no change needed
  • Tests added for both exception types

Test plan

  • testJsonSchemaRequestException → 400 with application/vnd.error+json
  • testJsonSchemaResponseException → 500
  • Existing testException (404) and testError (PHP Error → 500) still pass

🤖 Generated with Claude Code

Raise the minimum bear/resource requirement to ^1.33 which introduces
JsonSchemaRequestException / JsonSchemaResponseException. In ThrowableHandler,
normalise JsonSchemaRequestException into BadRequestException (code 400) so
VndError emits the correct 4xx status instead of falling through to 500.
JsonSchemaResponseException (server-side schema mismatch) is unchanged and
continues to produce a 500.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a9f8567-82b6-43a3-adaf-922538f1ad3c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/json-schema-exception-handler

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (adec301) to head (6fb63e7).
⚠️ Report is 5 commits behind head on 1.x.

Additional details and impacted files
@@             Coverage Diff             @@
##                 1.x      #189   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        52        53    +1     
===========================================
  Files             18        18           
  Lines            131       125    -6     
===========================================
- Hits             131       125    -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant