Skip to content

Add SchemaBrokenReferenceError to distinguish broken references after transformation#919

Open
staging-devin-ai-integration[bot] wants to merge 2 commits intomainfrom
core-defau-30db148d
Open

Add SchemaBrokenReferenceError to distinguish broken references after transformation#919
staging-devin-ai-integration[bot] wants to merge 2 commits intomainfrom
core-defau-30db148d

Conversation

@staging-devin-ai-integration
Copy link
Copy Markdown

Add SchemaBrokenReferenceError to distinguish broken references after transformation

Summary

This PR introduces a new SchemaBrokenReferenceError exception class as a subclass of SchemaReferenceError. The default implementation of SchemaTransformRule::rereference now throws this more specific error type instead of the generic SchemaReferenceError.

This change allows users of the transformer API to distinguish between references that break during transformation versus other types of reference errors, making error handling more precise and debugging easier.

Changes:

  • Added SchemaBrokenReferenceError class in jsonschema_error.h that extends SchemaReferenceError
  • Updated SchemaTransformRule::rereference in transformer.cc to throw the new error type
  • Updated test rereference_not_fixed_ref to catch the more specific error type

Backward Compatibility: Since SchemaBrokenReferenceError is a subclass of SchemaReferenceError, existing code that catches SchemaReferenceError will continue to work without modification.

Review & Testing Checklist for Human

  • Verify the error message "The reference broke after transformation" is appropriate and helpful for users
  • Confirm the inheritance hierarchy makes sense (broken reference is indeed a type of reference error)
  • Check if there are other places in the codebase or downstream projects that might benefit from catching this specific error type
  • Run the full test suite locally to ensure all transformer tests pass, especially rereference_not_fixed_ref

Test Plan

  1. Run make to verify all tests pass
  2. Optionally, create a simple test case that intentionally breaks a reference during transformation and verify the new error type is thrown with the correct details

Notes

- Created new SchemaBrokenReferenceError class that extends SchemaReferenceError
- Updated default SchemaTransformRule::rereference to throw SchemaBrokenReferenceError
- Updated test to catch the more specific error type
- This allows distinguishing broken references from other reference errors

Co-Authored-By: unknown <>
@staging-devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Resolved conflicts by accepting main branch's implementation of SchemaBrokenReferenceError which uses inherited constructors instead of a custom constructor with hardcoded message.

Co-Authored-By: unknown <>
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.

0 participants