Skip to content

bug: Generated Exception.toString() does not surface Rust Display/Debug error messages #128

Description

@Ugarba202

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:

  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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions