Skip to content

Improve error messages for misconfigured backends #3

@TheCryptoDonkey

Description

@TheCryptoDonkey

When a Lightning backend is misconfigured (wrong URL, missing credentials, unreachable host), the first error a developer sees comes from a failed HTTP call deep in the backend code. Adding eager validation in the backend factory functions would surface clear, actionable messages at startup rather than at first request time.

Scope

  • Add URL format validation in phoenixdBackend(), lndBackend(), clnBackend(), and lnbitsBackend() factory functions
  • Validate that required credentials are present and non-empty (e.g. password for Phoenixd, macaroon for LND, rune for CLN)
  • Throw descriptive errors like "phoenixdBackend: password is required" or "lndBackend: url must start with https://"
  • Add unit tests for each validation case

Helpful context

  • src/backends/phoenixd.ts, src/backends/lnd.ts, src/backends/cln.ts, src/backends/lnbits.ts - the four backend factories
  • src/booth.ts lines 92-95 - existing validation pattern in the Booth constructor
  • src/backends/conformance.ts - shared test factory (can be extended)
  • Estimated effort: 2-3 hours

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