Skip to content

Support Type::Custom{ builtin: Enum|Object, .. } as throws type - #2658

Merged
mhammond merged 1 commit into
mozilla:mainfrom
flisky:custom-throws-type
Sep 25, 2025
Merged

mhammond merged 1 commit into
mozilla:mainfrom
flisky:custom-throws-type

Conversation

@flisky

@flisky flisky commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@flisky
flisky requested a review from a team as a code owner September 18, 2025 12:18
@flisky
flisky requested review from mhammond and removed request for a team September 18, 2025 12:18
@flisky
flisky force-pushed the custom-throws-type branch 2 times, most recently from c651ec9 to 0896acb Compare September 18, 2025 13:28

@mhammond mhammond left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great, thanks. A changelog entry would be nice too. cc @bendk to check my thinking re the pipeline?

{%- match callable.throws_type.ty %}
{%- when Some(e) %}
{%- match e.ty %}
{%- match e.ty.canonical() %}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the right thing here is a new pipeline pass, eg, "error.rs"? It would walk Callable and adjust throws_type directly. This would also then handle CallbackInterfaceImpl.py

@mhammond
mhammond merged commit 76e040f into mozilla:main Sep 25, 2025
jhugman added a commit to jhugman/uniffi-bindgen-react-native that referenced this pull request Feb 25, 2026
Add `CustomTupleError` fixture to demonstrate and test custom types used
as error types. Update `ffi_error_converter_name` in filters.rs to unwrap
`Type::Custom { builtin }` when the builtin is an Enum or Object, so the
correct FfiConverter is used for error handling.

Corresponding to mozilla/uniffi-rs#2658
jhugman added a commit to jhugman/uniffi-bindgen-react-native that referenced this pull request Feb 25, 2026
Add `CustomTupleError` fixture to demonstrate and test custom types used
as error types. Update `ffi_error_converter_name` in filters.rs to unwrap
`Type::Custom { builtin }` when the builtin is an Enum or Object, so the
correct FfiConverter is used for error handling.

Corresponding to mozilla/uniffi-rs#2658
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.

2 participants