mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-15 04:27:20 +03:00
fix(core): drop Claude Code's /login hint from login errors (#60592)
This commit is contained in:
@@ -17,7 +17,10 @@ export function make() {
|
||||
const status = message.subtype === "success" ? (message.api_error_status ?? undefined) : undefined
|
||||
const httpError = status !== undefined && status >= 400
|
||||
if (message.subtype === "success" && !message.is_error && !httpError) return
|
||||
const result = message.subtype === "success" ? message.result : message.errors.join("\n")
|
||||
const result = (message.subtype === "success" ? message.result : message.errors.join("\n")).replaceAll(
|
||||
"Please run /login",
|
||||
"Run `claude auth login` in a terminal",
|
||||
)
|
||||
const failure =
|
||||
status !== undefined && status >= 500
|
||||
? (status === 529 ? "Anthropic is overloaded (529)." : `Anthropic returned HTTP ${status}.`) +
|
||||
@@ -29,8 +32,7 @@ export function make() {
|
||||
limited && !failure ? `Claude Code subscription limit reached${window ? ` (${window})` : ""}.` : failure
|
||||
const reset = limited && rejected?.resetsAt ? ` Resets at ${new Date(rejected.resetsAt * 1000).toISOString()}.` : ""
|
||||
const billing = code === "billing_error" ? " Check your Claude plan and extra-usage settings." : ""
|
||||
const auth = code === "authentication_failed" ? " Run `claude auth login` in a terminal." : ""
|
||||
const text = limit + reset + billing + auth
|
||||
const text = limit + reset + billing
|
||||
|
||||
if (text) return new Error(text)
|
||||
if (status) return new Error(`Claude Code could not finish its reply (HTTP ${status})`)
|
||||
|
||||
Reference in New Issue
Block a user