Skip to content

Commit a8e4fbb

Browse files
authored
fix: add 400 suggestions to org-all issue list path (CLI-BY) (#497)
## Problem The org-all code path (`sentry issue list org/`) was missing the 400 Bad Request suggestions added in PR #489. When the API returns 400, users see a bare error without guidance. Affects **23 users** ([CLI-BY](https://sentry.sentry.io/issues/7316799779/)). ## Fix Wrapped the `fetchOrgAllIssues` call in `handleOrgAllIssues` with a try-catch that enriches 400 errors using the existing `build400Detail()` helper — the same one used by `handleResolvedTargets`. Users now see suggestions about query syntax, period, and project access in both code paths.
1 parent 7d9c6b9 commit a8e4fbb

1 file changed

Lines changed: 27 additions & 8 deletions

File tree

src/commands/issue/list.ts

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -826,15 +826,34 @@ async function handleOrgAllIssues(
826826

827827
setContext([org], []);
828828

829-
const { issues, nextCursor } = await withProgress(
830-
{ message: `Fetching issues (up to ${flags.limit})...`, json: flags.json },
831-
(setMessage) =>
832-
fetchOrgAllIssues(org, flags, cursor, (fetched, limit) =>
833-
setMessage(
834-
`Fetching issues, ${fetched} and counting (up to ${limit})...`
829+
let issuesResult: IssuesPage;
830+
try {
831+
issuesResult = await withProgress(
832+
{
833+
message: `Fetching issues (up to ${flags.limit})...`,
834+
json: flags.json,
835+
},
836+
(setMessage) =>
837+
fetchOrgAllIssues(org, flags, cursor, (fetched, limit) =>
838+
setMessage(
839+
`Fetching issues, ${fetched} and counting (up to ${limit})...`
840+
)
835841
)
836-
)
837-
);
842+
);
843+
} catch (error) {
844+
// Enrich 400 errors with the same suggestions as handleResolvedTargets
845+
// (CLI-BY, 23 users). The org-all path was missing these hints.
846+
if (error instanceof ApiError && error.status === 400) {
847+
throw new ApiError(
848+
error.message,
849+
error.status,
850+
build400Detail(error.detail, flags),
851+
error.endpoint
852+
);
853+
}
854+
throw error;
855+
}
856+
const { issues, nextCursor } = issuesResult;
838857

839858
if (nextCursor) {
840859
setPaginationCursor(PAGINATION_KEY, contextKey, nextCursor);

0 commit comments

Comments
 (0)