Skip to content

Commit 5e57ffe

Browse files
committed
fix(source-control): show why an expired Origin list position failed
1 parent f69b5f9 commit 5e57ffe

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

‎packages/source-control-cursor-origin/src/server/OriginPullRequestProvider.ts‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const VIEWER_PERMISSIONS: PullRequestViewerPermissions = {
8282
};
8383

8484
const PAGE_SIZE = 100;
85+
const EXPIRED_LIST_POSITION = "listChangeRequests.resume";
8586
/** Bounds each paged read, so one very long pull request cannot stall its detail. */
8687
const MAX_PAGES = 10;
8788

@@ -620,7 +621,7 @@ export const make = Effect.gen(function* () {
620621
const pageToken = resume === undefined ? undefined : pageTokens.get(resume);
621622
if (resume !== undefined && pageToken === undefined)
622623
return yield* new OriginCli.OriginCliError({
623-
operation: "listChangeRequests",
624+
operation: EXPIRED_LIST_POSITION,
624625
cwd: input.cwd,
625626
reason: "failed",
626627
detail: "This list position has expired. Refresh the list to load more pull requests.",
@@ -679,7 +680,19 @@ export const make = Effect.gen(function* () {
679680
...(next === null ? {} : { resumeAfter: pageTokenKey(next) }),
680681
};
681682
},
682-
Effect.mapError(fail("listChangeRequests")),
683+
Effect.mapError((error) =>
684+
// The list shows only a failure's access hint, and this one needs its refresh advice.
685+
error.operation === EXPIRED_LIST_POSITION
686+
? new PullRequestProviderError({
687+
provider: SourceControlProviderKind.make("cursor-origin"),
688+
operation: "listChangeRequests",
689+
reason: "failed",
690+
detail: error.detail,
691+
accessHint: error.detail,
692+
cause: error,
693+
})
694+
: fail("listChangeRequests")(error),
695+
),
683696
),
684697

685698
// One read: linked threads poll this, and the full detail costs four.

0 commit comments

Comments
 (0)