Skip to content

Handle deployment errors gracefully with user-facing error messages #83

Description

@Pvsaint

Summary

DeployButton.tsx catches errors from deployContract() and sets status = 'error', which changes the button label to "Failed — Retry". But the actual error message is swallowed by the empty catch block and never shown to the user. The user has no idea what went wrong.

Problem

The catch block in DeployButton.tsx is:

} catch {
  setStatus("error")
}

This discards all error details. Common failure modes that need clear messaging include:

  • Freighter not installed
  • User rejected the wallet connection in Freighter
  • Insufficient XLM balance on Testnet
  • Network / RPC timeout
  • Transaction submission failure (e.g. sequence number mismatch)

Expected Behaviour

  1. When deployment fails, a descriptive error message is displayed (in a toast, modal, or inline below the button).
  2. The raw error is logged to the console for debugging.
  3. Where possible, actionable guidance is given ("Fund your Testnet account at https://laboratory.stellar.org/").

Acceptance Criteria

  • The catch block captures the error object: catch (err).
  • A errorMessage state variable stores a user-facing string derived from the error.
  • The error message is rendered in the UI (not just in the button label).
  • Known error types are mapped to friendly messages (Freighter rejection, insufficient balance, network error).
  • Unknown errors fall back to "Deployment failed. Check the console for details."
  • The error is always logged with console.error.
  • The error message is dismissible and clears when the user retries.

References

  • src/components/editor/DeployButton.tsx lines 16–20
  • src/lib/stellar/deploy.ts

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignbugSomething isn't workingdifficulty: EasyGood for beginners, low complexityfrontendFrontend / UI workstellar-integrationStellar SDK / wallet integration

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions