bitcoindevkit / bitcoindevkit/bdk-dart
bug: Generated Exception.toString() does not surface Rust Display/Debug error messages
- Dominant language
- Dart
- Stars
- 13
- Forks
- 20
- Avg merge
- 24m
- Merged PRs (30d)
- 3
Description
## 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:
https://github.com/bitcoindevkit/bdk-dart/pull/124#discussion_r3754697013
Opening this tracking issue in `bdk-dart` so we can:
1. Track the current behavior downstream.
2. Link the upstream `uniffi-dart` issue/PR when filed.
3. Update the `uniffi-dart` pin and verify error string output once fixed upstream.
Contributor guide
Research direction
Start by inspecting the generated exception implementations and the Display/Debug bindings in lib/bdk.dart, then read the linked PR #124 discussion for the upstream context. Track the relevant uniffi-dart fix, update the pin once available, and verify that exception toString() includes the Rust error message rather than only the Dart class name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100