Skip to content

walletError cause option appends the cause message to message #269

Open

Description

@github-actions

Expected Behavior

walletError({ code, message, cause }) in src/shared/errors.ts keeps message as given, so a site can attach the underlying error without changing the text that users, tests, and callers matching on error.message see.

Current Behavior

incur's BaseError sets message to ${shortMessage}\n\nDetails: ${cause.message} whenever cause is an Error, so passing cause changes the reported message. A spawn failure typed with cause: error reported Failed to run sqlite3 for the lock at <path>: spawn sqlite3 EACCES, then a blank line and Details: spawn sqlite3 EACCES, repeating the cause and breaking exact-message matches.

Possible Solution

Say on walletError that cause appends Details: <cause message> to message, with the given text kept on shortMessage, or let callers attach a cause without changing message.

Minimal Reproducible Example

walletError({ code: "E_RUNTIME", message: "failed", cause: new Error("boom") }).message is "failed\n\nDetails: boom".

Context

Hit while replacing bare Error rejections in src/payment/session-lock.ts with typed errors that keep their message text.


Logged by Brendan Ryan in tempoxyz/wallet-cli at 23c6345. Filed by Frog.

Activity

  1. sharmis-tp commented on Oct 19, 2026

    @sharmis-tp

    I'd like to pick this up. My preference is to change walletError in src/shared/errors.ts so passing cause keeps message as given, with a test that walletError({ code: "E_RUNTIME", message: "failed", cause: new Error("boom") }).message is "failed" and the cause is still attached. Does that work for you, or would you rather keep incur's BaseError behavior and just document that cause appends Details: <cause message>?

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions