Skip to content
Merged
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
6 changes: 6 additions & 0 deletions packages/cli/src/lib/docs-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ async function postDocs<T>(
EXIT.API
);
}
if (parsed?.code === "DOCS_MODEL_UNAVAILABLE") {
throw new CliError(
"Sentry Docs AI is temporarily unavailable in this region. Please try again later.",
EXIT.API
);
}
if (typeof parsed?.error === "string") {
detail = parsed.error;
}
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/test/lib/docs-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,32 @@ import { queryDocs } from "../../src/lib/docs-service.js";
import { EXIT, isUserError } from "../../src/lib/errors.js";

describe("queryDocs", () => {
test("explains when Docs AI is unavailable in the service region", async () => {
refreshToken.mockResolvedValue({ token: "test-token" });
customFetch.mockResolvedValue({
ok: false,
status: 502,
text: vi.fn().mockResolvedValue(
JSON.stringify({
code: "DOCS_MODEL_UNAVAILABLE",
error: "Sentry Docs AI is temporarily unavailable in this region.",
})
),
});

await expect(
queryDocs("How do I configure tracing?", {
frameworks: [],
languages: [],
sentryConfigured: false,
})
).rejects.toMatchObject({
exitCode: EXIT.API,
message:
"Sentry Docs AI is temporarily unavailable in this region. Please try again later.",
});
});

test("explains when the service cannot verify a cited answer", async () => {
refreshToken.mockResolvedValue({ token: "test-token" });
customFetch.mockResolvedValue({
Expand Down
Loading