Module breez_sdk_core::binding

source ·
Expand description

Bindings for the Dart integration

§Error handling

Since the integration requires the methods to return anyhow::Result, but the SDK service methods are being converted to return SdkResult, we have two ways to handle errors:

  • by using Into::into, which converts the SdkError enum to a generic anyhow::Error
  • by wrapping the SdkError in an anyhow::Error

The first option loses the SdkError type. The second option keeps the type, which we can retrieve with anyhow::Error::downcast_ref (or equivalent Dart method). We therefore use the second approach.

Functions§