Skip to content

Commit fbd742d

Browse files
betegonclaude
andcommitted
fix(issue): tighten error handling in shortid fan-out
- Only throw when ALL orgs returned real errors, not when some returned clean 404s (fixes false positive from unrelated org's 403) - Handle non-API errors (network timeouts, DNS failures) alongside API errors by checking instanceof Error instead of instanceof ApiError Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 30d6332 commit fbd742d

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/commands/issue/utils.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,17 @@ async function resolveProjectSearch(
219219
);
220220
}
221221

222-
// If all orgs failed with non-404 errors (e.g., 403, 5xx), surface the
223-
// real error instead of falling through to a misleading "not found".
224-
if (successes.length === 0) {
225-
const realErrors = results.filter(
226-
(r): r is AuthGuardFailure => r !== undefined && !r.ok
227-
);
222+
// If every org failed with a real error (403, 5xx, network timeout),
223+
// surface it instead of falling through to a misleading "not found".
224+
// Only throw when ALL results are errors — if some orgs returned clean
225+
// 404s ({ok: true, value: null}), fall through to the fallback for a
226+
// precise error message.
227+
const realErrors = results.filter(
228+
(r): r is AuthGuardFailure => r !== undefined && !r.ok
229+
);
230+
if (realErrors.length === results.length && realErrors.length > 0) {
228231
const firstError = realErrors[0]?.error;
229-
if (firstError instanceof ApiError && firstError.status !== 404) {
232+
if (firstError instanceof Error) {
230233
throw firstError;
231234
}
232235
}

0 commit comments

Comments
 (0)