Skip to content

Rename FFI error types to avoid naming conflicts#830

Merged
spacebear21 merged 2 commits intopayjoin:masterfrom
spacebear21:ffi-error-fixes
Jul 1, 2025
Merged

Rename FFI error types to avoid naming conflicts#830
spacebear21 merged 2 commits intopayjoin:masterfrom
spacebear21:ffi-error-fixes

Conversation

@spacebear21
Copy link
Collaborator

The first commit renames receive::Error to ReceiverError to avoid conflicts in languages where Error is a reserved keyword.

The second commit renames TerminalError to TerminalErr as a workaround to a quirk in uniffi-dart (see commit message for more detail)

@spacebear21 spacebear21 requested a review from arminsabouri June 30, 2025 23:05
@coveralls
Copy link
Collaborator

coveralls commented Jun 30, 2025

Pull Request Test Coverage Report for Build 16005924185

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 85.487%

Totals Coverage Status
Change from base Build 15983582431: 0.0%
Covered Lines: 7251
Relevant Lines: 8482

💛 - Coveralls

@0xZaddyy
Copy link
Contributor

0xZaddyy commented Jul 1, 2025

This looks great!

Would it make sense to add a brief note in the type doc comments that these names are shaped partly by FFI constraints? might help future contributors understand the reason behind choices like ReceiverError and TerminalErr.

Copy link
Collaborator

@arminsabouri arminsabouri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeACK. Justification for code change makes sense to me.

Small typos in the commit message

  • is areserved => are reserved
  • importedas

Comment on lines -160 to +163
pub fn save<P>(&self, persister: &P) -> Result<InitializedTransitionOutcome, ReceiverPersistedError>
pub fn save<P>(
&self,
persister: &P,
) -> Result<InitializedTransitionOutcome, ReceiverPersistedError>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non blocking error. Just noticed that this is a pure fmt change. Probably bc we dont run fmt --check on ci for this crate.

The name `Error` causes conflicts in other languages where `Error` is
a reserved keyword. And since uniffi doesn't support namespacing
per mozilla/uniffi-rs#1849, this would be imported as `payjoin::Error` for
implementers downstream, which is ambiguous. Renaming to `ReceiverError`
fixes both of these issues.
"Error" gets replaced by "Exception" in uniffi-dart to respect dart
conventions, causing issues. Since this isn't a struct native to
rust-payjoin and not an actual `Error`, the easy fix is to rename it.
@spacebear21
Copy link
Collaborator Author

Corrected the typos, thanks!

@spacebear21 spacebear21 merged commit 40e1035 into payjoin:master Jul 1, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants