Skip to content

Handle unexpected server error codes gracefully #684

@steveluscher

Description

@steveluscher

Motivation

When we forget to add an error message to packages/errors/src/messages.ts, or when a server delivers an unexpected custom code, we fatal in the message printer (in development mode only).

const messageFormatString = SolanaErrorMessages[code];
if (messageFormatString.length === 0) {
return '';
}

See this PR for an example of when the server acquired error codes that we were late adding to the client: #658.

Details

The solution should:

  • have minimal impact on bundle size
  • give the developer enough information to recover from the actual error
  • give the developer further information on what to do to have the actual error message materialize on the console and in the npx @solana/errors decode CLI. This means directing them to either update to the latest version of Kit, or to submit a pull request if the error code is missing in the latest version

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions