Skip to content

Refactor connectPeer error handling to be consistent with openChannel #3814

@myxmaster

Description

@myxmaster

Describe your enhancement idea

connectPeer in ChannelsStore communicates errors through two channels simultaneously: it sets MobX observables (errorMsgPeer, errorPeerConnect) for the UI, and also calls reject() on the returned promise for programmatic
use. openChannel only uses observables. No caller of connectPeer actually uses the rejection meaningfully, they either swallow it or just log it. This inconsistency results in unhandled promise rejections and makes the API confusing to work with.

Both, connectPeer and openChannel should follow the same pattern:

  • Always resolve(true/false) (never reject())
  • Set observables for UI error display
  • Return a Promise<boolean> so callers can react programmatically without try/catch

This gives callers a clean, consistent API:

const connected = await connectPeer(...);
if (connected) await openChannel(...);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions