Skip to content
Open
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
5 changes: 3 additions & 2 deletions packages/cli/src/lib/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { redactCredentialText } from "./credential-redaction.js";
import {
buildBillingUrl,
buildOrgSettingsUrl,
buildSeerAutoReloadUrl,
buildSeerSettingsUrl,
buildSourceCodeIntegrationsUrl,
} from "./sentry-urls.js";
Expand Down Expand Up @@ -932,8 +933,8 @@ export class SeerError extends CliError {
// out_of_credits orgs already have Seer, so a trial is not the fix.
// Sentry doesn't say whether auto-reload is off or has run through its
// top-ups, so the advice covers both.
out_of_credits: `Someone with billing access can adjust Seer spend and auto-reload in Sentry:\n ${buildBillingUrl(this.orgSlug, "seer")}`,
daily_cap_exceeded: `Someone with billing access can raise the limit in Sentry, or you can try again tomorrow:\n ${buildBillingUrl(this.orgSlug, "seer")}`,
out_of_credits: `Someone with billing access can adjust Seer spend and auto-reload in Sentry:\n ${buildSeerAutoReloadUrl(this.orgSlug)}`,
daily_cap_exceeded: `Someone with billing access can raise the limit in Sentry, or you can try again tomorrow:\n ${buildSeerAutoReloadUrl(this.orgSlug, "daily_cap_exceeded")}`,
// Setup gaps are fixed in Sentry settings, not with a trial.
scm_integration_required: `Connect GitHub or GitLab to Sentry:\n ${buildSourceCodeIntegrationsUrl(this.orgSlug)}`,
repos_not_linked: `Connect the project's repositories in Seer settings:\n ${buildSeerSettingsUrl(this.orgSlug)}`,
Expand Down
16 changes: 16 additions & 0 deletions packages/cli/src/lib/sentry-urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,22 @@ export function buildBillingUrl(orgSlug: string, product?: string): string {
return product ? `${base}?product=${product}` : base;
}

/**
* Build URL to the billing page with the Seer auto-reload modal open.
*
* @param orgSlug - Organization slug
* @param denialReason - Why Seer stopped, which the modal uses for its copy
*/
export function buildSeerAutoReloadUrl(
orgSlug: string,
denialReason?: string,
): string {
const hash = denialReason
? `#open-seer-auto-reload-modal:${denialReason}`
: "#open-seer-auto-reload-modal";
return `${buildBillingUrl(orgSlug)}${hash}`;
}

// Logs URLs

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/test/lib/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,20 +397,20 @@ describe("SeerError", () => {
expect(formatted).toContain("my-org");
});

test("format() includes billing URL for out_of_credits with orgSlug", () => {
test("format() links auto-reload modal for out_of_credits with orgSlug", () => {
const formatted = new SeerError("out_of_credits", "my-org").format();
expect(formatted).toContain("Your organization is out of Seer credits.");
expect(formatted).toContain(
"https://my-org.sentry.io/settings/billing/overview/?product=seer",
"https://my-org.sentry.io/settings/billing/overview/#open-seer-auto-reload-modal",
);
});

test("format() includes billing URL for daily_cap_exceeded with orgSlug", () => {
test("format() links auto-reload modal with reason for daily_cap_exceeded with orgSlug", () => {
const formatted = new SeerError("daily_cap_exceeded", "my-org").format();
expect(formatted).toBe(
"Your organization has reached its daily Seer spend limit.\n\n" +
"Someone with billing access can raise the limit in Sentry, or you can try again tomorrow:\n" +
" https://my-org.sentry.io/settings/billing/overview/?product=seer",
" https://my-org.sentry.io/settings/billing/overview/#open-seer-auto-reload-modal:daily_cap_exceeded",
);
});

Expand Down
Loading