[pull] master from cube-js:master - #676
Merged
Merged
Conversation
…API (#11592) * feat(cli): suggest updating the CLI on API errors API errors are frequently caused by an outdated CLI talking to a newer API, so the error output now suggests updating the CLI as a possible fix. - add a shared `ApiError` (with status, url and response body) plus an `isApiError` marker-based type guard - throw it from `CubeCloudClient` requests and from `cubejs typegen` instead of a bare `Error`, and include the response body in the message - pass the caught error into `displayError` from every command so the update suggestion is printed under "Need some help?" for API errors - fix `cubejs typegen` crashing inside its own catch block when the failure isn't shaped like `{ error: { error } }` (e.g. network errors) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jv8Ykk5wWXab2KjCsK58vi * Revert "feat(cli): suggest updating the CLI on API errors" This reverts commit b2cddfe. * feat(cube-cli): suggest updating the CLI when a request fails on the API A CLI that lags the API is a common cause of otherwise puzzling API errors, so point at `cube update` before the user starts digging. - add `ApiError`, a marker error type for failures that came from an API response (unsuccessful status, or a body the CLI can't make sense of), and `is_api_error` to spot it anywhere in an error chain - return it from the API client and from the OAuth device/refresh flows; transport failures (DNS, TLS, connection refused) stay plain errors, since an update won't fix those - print a hint under the error when the failure is an API error, pointing at the update notice instead of repeating it when one was just shown - honor `CUBE_NO_UPDATE_CHECK` for the hint too, and document it Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jv8Ykk5wWXab2KjCsK58vi * fix(cube-cli): only suggest an update when the CLI is actually behind Telling someone already on the latest release to update is noise that teaches them to ignore the hint, so consult the background release check before offering it. - turn the check's result into an `UpdateCheck` outcome (newer / up to date / disabled / undetermined) instead of a pre-rendered notice, and resolve it once for both the notice and the hint - print no hint when the CLI is current or checks are opted out; name the available release when it is behind; suggest looking when the check could not complete - color the hint on a terminal, matching the notice it sits under, and keep it plain in piped output - cover the policy with tests that don't touch env or terminal state Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jv8Ykk5wWXab2KjCsK58vi * fix(cube-cli): don't make piped runs wait on the release check Resolving the check moved ahead of both its consumers, so every non-interactive run paid up to 1.5s for an answer it then discarded: the notice is interactive-only, and the hint only runs on an API failure. A piped successful command took 1526ms against an unresponsive release endpoint, against 28ms with checks opted out. Await the handle only when something will read it — 24ms on that same path now, with the notice and all four hint outcomes unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jv8Ykk5wWXab2KjCsK58vi * fix(cube-cli): print the error before waiting on the release check Only the hint needs the check's answer, so a slow or blocked GitHub sat between the user and the reason their command failed — 1521ms of silence against an unresponsive release endpoint, now 20ms. The notice moves below the error line on a failing run as a result, which also puts it directly above the hint that refers back to it. Successful runs are unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jv8Ykk5wWXab2KjCsK58vi --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )