Summary
When an error occurs across the FFI boundary, the generated Dart exception classes only print their static class name (e.g., MissingUtxoAddForeignUtxoException) when converted to a string, rather than including the contextual error message provided by Rust's Display or Debug traits.
Problem Description
In the recent bdk-ffi 3.1 bump (#124), Display and Debug implementations for errors were generated into lib/bdk.dart (such as uniffi_bdkffi_fn_method_addforeignutxoerror_uniffi_trait_debug), but the Dart Exception.toString() implementation does not call them.
As a result:
- Catching and logging an exception with
print('Error: $e') or e.toString() only outputs the generic Dart type name.
- Developers and testers lose the specific underlying reason why the operation failed in Rust (e.g. detailed fee calculation errors, missing UTXO IDs, or descriptor parse errors).
Context & Prior Discussion
This was noted during the review of PR #124 by @Johnosezele and @reez:
#124 (comment)
Opening this tracking issue in bdk-dart so we can:
- Track the current behavior downstream.
- Link the upstream
uniffi-dart issue/PR when filed.
- Update the
uniffi-dart pin and verify error string output once fixed upstream.
Summary
When an error occurs across the FFI boundary, the generated Dart exception classes only print their static class name (e.g.,
MissingUtxoAddForeignUtxoException) when converted to a string, rather than including the contextual error message provided by Rust'sDisplayorDebugtraits.Problem Description
In the recent
bdk-ffi3.1 bump (#124),DisplayandDebugimplementations for errors were generated intolib/bdk.dart(such asuniffi_bdkffi_fn_method_addforeignutxoerror_uniffi_trait_debug), but the DartException.toString()implementation does not call them.As a result:
print('Error: $e')ore.toString()only outputs the generic Dart type name.Context & Prior Discussion
This was noted during the review of PR #124 by @Johnosezele and @reez:
#124 (comment)
Opening this tracking issue in
bdk-dartso we can:uniffi-dartissue/PR when filed.uniffi-dartpin and verify error string output once fixed upstream.