Skip to content

exit code 3 added#648

Open
RitoG09 wants to merge 2 commits intosourcemeta:mainfrom
RitoG09:fix/#153
Open

exit code 3 added#648
RitoG09 wants to merge 2 commits intosourcemeta:mainfrom
RitoG09:fix/#153

Conversation

@RitoG09
Copy link

@RitoG09 RitoG09 commented Feb 5, 2026

Related to issue: sourcemeta/studio#153
Following the existing CLI convention used for exit code 2, this PR updates those cannot-start paths to return exit code 3.

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.

4 issues found across 5 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/command_validate.cc">

<violation number="1" location="src/command_validate.cc:181">
P1: Replacing `FileError` with `Fail{3}` causes the CLI to exit with code 3 but suppresses all error details (message, location, file path). The `Fail` exception type does not carry error information, and the `try_catch` handler in `src/error.h` simply returns the exit code without printing anything. This leaves the user with no indication of why the operation failed.

To fix this while keeping exit code 3, you should either:
1. Update `src/error.h` to map these `FileError` types to exit code 3 (preferred).
2. Explicitly print the error using `sourcemeta::jsonschema::print_exception` before throwing `Fail{3}`.

(Based on your team's feedback about reusing centralized error wrapper types.) [FEEDBACK_USED]</violation>
</file>

<file name="src/command_lint.cc">

<violation number="1" location="src/command_lint.cc:279">
P2: Replacing FileError wrappers with `Fail{3}` suppresses error reporting (including JSON error details and file path). `Fail` is caught only to return the exit code, so users lose the underlying schema error context entirely.</violation>
</file>

<file name="src/command_fmt.cc">

<violation number="1" location="src/command_fmt.cc:75">
P2: These schema exceptions were previously wrapped in `FileError` to preserve file path and structured error details. Replacing them with `Fail{3}` suppresses that context because `try_catch` returns the exit code without printing or serializing the error. Keep the `FileError` wrapper (and map it to exit code 3 in the central handler) so users still get file/keyword context for these failures.

(Based on your team's feedback about reusing centralized error wrapper types.) [FEEDBACK_USED]</violation>
</file>

<file name="src/command_metaschema.cc">

<violation number="1" location="src/command_metaschema.cc:51">
P2: Throwing `Fail{3}` here drops the schema dialect error details and file path, because `Fail` is handled by returning an exit code without emitting any error output. This makes the CLI fail silently (including in `--json` mode). Preserve the `FileError` wrapper or add error handling that still prints the contextual error while returning exit code 3.

(Based on your team's feedback about reusing centralized error wrapper types.) [FEEDBACK_USED]</violation>
</file>

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

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 (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/command_lint.cc">

<violation number="1">
P1: The PR description states these paths should return exit code 3. However, `FileError` for `CompilerReferenceTargetNotSchemaError`, `SchemaKeywordError`, and `SchemaFrameError` is caught in `src/error.h` and explicitly returns `EXIT_FAILURE` (1), not 3. You must update `src/error.h` to return 3 for these error types to match the PR goal.

(Based on your team's feedback about reusing centralized error wrappers.) [FEEDBACK_USED]</violation>
</file>

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

@@ -276,7 +276,7 @@ auto sourcemeta::jsonschema::lint(const sourcemeta::core::Options &options)
std::cerr << "\n";
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 5, 2026

Choose a reason for hiding this comment

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

P1: The PR description states these paths should return exit code 3. However, FileError for CompilerReferenceTargetNotSchemaError, SchemaKeywordError, and SchemaFrameError is caught in src/error.h and explicitly returns EXIT_FAILURE (1), not 3. You must update src/error.h to return 3 for these error types to match the PR goal.

(Based on your team's feedback about reusing centralized error wrappers.)

View Feedback

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/command_lint.cc, line 287:

<comment>The PR description states these paths should return exit code 3. However, `FileError` for `CompilerReferenceTargetNotSchemaError`, `SchemaKeywordError`, and `SchemaFrameError` is caught in `src/error.h` and explicitly returns `EXIT_FAILURE` (1), not 3. You must update `src/error.h` to return 3 for these error types to match the PR goal.

(Based on your team's feedback about reusing centralized error wrappers.) </comment>

<file context>
@@ -276,31 +276,37 @@ auto sourcemeta::jsonschema::lint(const sourcemeta::core::Options &options)
               }
 
-              throw Fail{3};
+              throw FileError<sourcemeta::core::SchemaKeywordError>(entry.first,
+                                                                    error);
             } catch (const sourcemeta::core::SchemaFrameError &error) {
</file context>
Fix with Cubic

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