-
-
Notifications
You must be signed in to change notification settings - Fork 229
Open
Labels
Description
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)(neverreject()) - 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(...);Reactions are currently unavailable