Skip to content

fix(updater): preserve command error details in failed update checks - #6482

Open
SailingLoong wants to merge 1 commit into
farion1231:mainfrom
SailingLoong:fix/preserve-updater-command-error-details
Open

fix(updater): preserve command error details in failed update checks#6482
SailingLoong wants to merge 1 commit into
farion1231:mainfrom
SailingLoong:fix/preserve-updater-command-error-details

Conversation

@SailingLoong

Copy link
Copy Markdown

Hi, and first of all — thank you for maintaining cc-switch. I maintain a small derivative project that keeps syncing with upstream, and I'd like to start giving back some fixes we've found along the way. This is the smallest one, so I figured it's a good icebreaker. 🙂

Summary

  • Replace err instanceof Error ? err.message : fallback with the existing extractErrorMessage helper in UpdateProvider.
  • The updater plugin rejects with plain strings, so instanceof Error is always false and the real failure reason (network error, rate limit, malformed latest.json, …) gets replaced by the generic fallback message shown to the user.
  • extractErrorMessage already exists in src/utils/errorUtils.ts and is used elsewhere; this is just the one call site that missed it.

Validation

  • npx tsc --noEmit
  • npx prettier --check src/contexts/UpdateContext.tsx

Happy to adjust the approach, wording, or split it differently if you prefer. And if there's a contribution guide or a preferred channel for this kind of small fix, just point me at it.

The updater plugin rejects with plain strings, so err instanceof Error is
always false and the real reason (network failure, rate limit, malformed
latest.json) is replaced by the generic fallback message. Use the existing
extractErrorMessage helper, which already handles strings and Error objects.
@farion1231

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 38c9e2698e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Frontend (React/TypeScript)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants