Description
NamedError — the base class for the serialized error union (ProviderAuthError, UnknownError, APIError, etc.) — sets Error.message to its own tag name. Its constructor calls super(name), so every instance ends up with Error.message === Error.name.
Because Cause.pretty and Error.prototype.toString() render an error as ${name}: ${message}, this comes out as ProviderAuthError: ProviderAuthError, and the real data.message is never shown.
Steps to reproduce
- Construct any
NamedError, e.g. new ProviderAuthError({ providerID, message: "invalid token" }).
- Render it via
Cause.pretty(Cause.fail(err)) or err.toString().
- Observe
"ProviderAuthError: ProviderAuthError" — the "invalid token" detail is hidden.
OpenCode version
dev (current)
Description
NamedError— the base class for the serialized error union (ProviderAuthError,UnknownError,APIError, etc.) — setsError.messageto its own tag name. Its constructor callssuper(name), so every instance ends up withError.message === Error.name.Because
Cause.prettyandError.prototype.toString()render an error as${name}: ${message}, this comes out asProviderAuthError: ProviderAuthError, and the realdata.messageis never shown.Steps to reproduce
NamedError, e.g.new ProviderAuthError({ providerID, message: "invalid token" }).Cause.pretty(Cause.fail(err))orerr.toString()."ProviderAuthError: ProviderAuthError"— the"invalid token"detail is hidden.OpenCode version
dev (current)