Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/src/lib/api/releases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ export async function setCommitsWithRefs(

/**
* Field of the {@link ValidationError} for a `--commit` repository the org
* doesn't have, so this user configuration error can be told apart (CLI-2SK).
* doesn't have. Error reporting treats it as user configuration (CLI-2SK).
*/
const COMMIT_REPOSITORY_FIELD = "commit.repository";

Expand Down
8 changes: 8 additions & 0 deletions packages/cli/src/lib/error-reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type SilenceReason =
| "process_exit"
| "user_validation"
| "user_input_error"
| "user_config"
| "seer_unavailable_self_hosted";

/**
Expand Down Expand Up @@ -144,6 +145,13 @@ export function classifySilenced(error: unknown): SilenceReason | null {
if (error instanceof ValidationError && error.field === "input") {
return "user_input_error";
}
// A ValidationError with field "commit.repository" means `release
// set-commits --commit` named a repository the org has not connected to
// Sentry. The fix is in the org's integration settings, which the error
// links to; nothing in the CLI is broken (CLI-2SK).
if (error instanceof ValidationError && error.field === "commit.repository") {
return "user_config";
}
// A ValidationError with field "directory" means the sourcemap directory
// the user passed is missing, not a directory, or unreadable. Pure
// user-input noise, not a CLI bug — the user sees the path and the
Expand Down
1 change: 1 addition & 0 deletions packages/cli/test/lib/api/releases.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,7 @@ describe("explainSetCommitsError", () => {
expect(message).toMatch(
/\/settings\/integrations\/\?category=source%20code%20management/,
);
expect(classifySilenced(error)).toBe("user_config");
});

test("suggests similar repositories and links the repository settings", async () => {
Expand Down
12 changes: 12 additions & 0 deletions packages/cli/test/lib/error-reporting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,18 @@ describe("classifySilenced", () => {
).toBe("user_input_error");
});

test("silences ValidationError with field 'commit.repository' (repository not in Sentry)", () => {
// set-commits --commit named a repository the org never connected (CLI-2SK).
expect(
classifySilenced(
new ValidationError(
"Sentry organization 'acme' has no repository named 'acme/web'.",
"commit.repository",
),
),
).toBe("user_config");
});

test("silences ValidationError with field 'directory' (bad sourcemap directory)", () => {
// A missing sourcemap upload/inject directory is user-input noise (CLI-1FN).
expect(
Expand Down
Loading