Skip to content

Commit

Permalink
Include function parameters in error messages
Browse files Browse the repository at this point in the history
For debugging purposes, it's important that error messages include as much relevant information as possible. It's much easier to help a user if they can pass on an accurate error message that they received.

But precisely because the messages should be in a form where the user can share it without worrying about leaking secrets (and because such errors may end up in logs that could leak), the messages must not include any confidential data.

They should also not be unnecessarily verbose.

To implement this, we add the "debug" serialization of the functions' input values to the error message that's returned if the call fails. We use the 'derivative' crate to "redact" fields containing secret or verbose data (i.e. they render as "...").
  • Loading branch information
bisgardo committed Apr 29, 2024
1 parent 33eb749 commit 388bcb7
Show file tree
Hide file tree
Showing 4 changed files with 310 additions and 32 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
crate-type = ["staticlib", "lib"]

[dependencies]
derivative = "2.2.0"
thiserror = "1"
uniffi = { version = "0.26", features = ["cli"] }
serde = "1.0"
Expand Down
Loading

0 comments on commit 388bcb7

Please sign in to comment.