Skip to content

Improve error handling on --resolve meta-schema errors#673

Merged
jviotti merged 1 commit intomainfrom
resolve-error-handling
Feb 23, 2026
Merged

Improve error handling on --resolve meta-schema errors#673
jviotti merged 1 commit intomainfrom
resolve-error-handling

Conversation

@jviotti
Copy link
Member

@jviotti jviotti commented Feb 23, 2026

See: #672
Signed-off-by: Juan Cruz Viotti jv@jviotti.com

@jviotti jviotti force-pushed the resolve-error-handling branch from fe8db85 to 8d1158b Compare February 23, 2026 13:19
@jviotti jviotti marked this pull request as ready for review February 23, 2026 13:20
@augmentcode
Copy link

augmentcode bot commented Feb 23, 2026

🤖 Augment PR Summary

Summary: This PR improves user-facing error reporting when importing schemas via --resolve, ensuring meta-schema resolution/validation errors are surfaced with the correct file context.

Changes:

  • Wraps additional schema-processing exceptions during --resolve import (SchemaKeywordError, SchemaReferenceError, SchemaResolutionError, and generic SchemaError) as FileError<...> so the CLI can print the originating file path.
  • Preserves identifier/value/keyword/location details when available, aligning output with the existing structured error printer.
  • Adds new Unix CLI tests covering common --resolve failure modes: unknown metaschema dialect, invalid $id URI, invalid $recursiveRef, and missing core vocabulary in a custom meta-schema.
  • Registers the new tests in test/CMakeLists.txt.

Technical Notes: The new test cases validate both human-readable stderr formatting and --json output for the same failures, reducing regressions in error-shaping behavior (see issue #672).

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

@jviotti jviotti force-pushed the resolve-error-handling branch from 8d1158b to 86941c0 Compare February 23, 2026 13:28
See: #672
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti force-pushed the resolve-error-handling branch from 86941c0 to 0acd41e Compare February 23, 2026 13:30
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 6 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/resolver.h">

<violation number="1" location="src/resolver.h:215">
P2: The `catch (const sourcemeta::core::SchemaResolutionError &error)` block will also catch any derived exception types (e.g., `SchemaRelativeMetaschemaResolutionError`) due to C++ exception handling order, causing type slicing when rethrowing as `FileError<SchemaResolutionError>`. This means downstream handlers will see the base type instead of the derived type, potentially showing a misleading "forgot to import using `--resolve/-r`" hint for errors that aren't actually about missing imports. Consider adding a catch block for derived resolution error types *before* this one to preserve the specific error semantics.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@jviotti jviotti merged commit 1b8811e into main Feb 23, 2026
13 checks passed
@jviotti jviotti deleted the resolve-error-handling branch February 23, 2026 13:34
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Feb 24, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [sourcemeta/jsonschema](https://github.com/sourcemeta/jsonschema) | patch | `v14.13.3` → `v14.13.4` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>sourcemeta/jsonschema (sourcemeta/jsonschema)</summary>

### [`v14.13.4`](https://github.com/sourcemeta/jsonschema/releases/tag/v14.13.4)

[Compare Source](sourcemeta/jsonschema@v14.13.3...v14.13.4)

#### What's Changed

- Fix bundling not de-duplicating equal schemas by [@&#8203;jviotti](https://github.com/jviotti) in [#&#8203;669](sourcemeta/jsonschema#669)
- Improve error handling on `--resolve` meta-schema errors by [@&#8203;jviotti](https://github.com/jviotti) in [#&#8203;673](sourcemeta/jsonschema#673)
- Respect ordering of `--resolve` arguments to avoid meta-schema ambiguity by [@&#8203;jviotti](https://github.com/jviotti) in [#&#8203;674](sourcemeta/jsonschema#674)

**Full Changelog**: <sourcemeta/jsonschema@v14.13.3...v14.13.4>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4zMS4xIiwidXBkYXRlZEluVmVyIjoiNDMuMzEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
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