-
Notifications
You must be signed in to change notification settings - Fork 263
Open
Description
I've been trying the latest merged changes that add support for external errors on Android, and I've found that UniFFI is not correctly doing the *Error
to *Exception
rename when the external error is being used inside another error type:
// This error is defined in crate-a
#[derive(uniffi::Error)]
pub enum TestError {
BadThingsHappened(String),
ErrorFromCrateB(crate_b::CrateBError),
}
// This error is defined in crate-b
#[derive(uniffi::Error)]
pub enum CrateBError {
CrateBScrewedUp(u64),
}
If I check the generated bindings, I can see that the rename is done correctly in crate_b.kt
:
sealed class CrateBException: kotlin.Exception() {
...
}
But when it gets imported in crate_a.kt
, the rename doesn't happen:
import uniffi.crate_b.CrateBError // <!--- Compile error here
sealed class TestException: kotlin.Exception() {
class BadThingsHappened(
val v1: kotlin.String
) : TestException() { ... }
class ErrorFromCrateB(
val v1: CrateBError // <!--- Compile error here
) : TestException() { ... }
If I manually rename the CrateBError
to CrateBException
in the file everything works correctly, so this seems to only be a bug in the template generation. Let me know if you need more info, I have a repro here if it's helpful: https://github.com/dani-garcia/uniffi-android-error-repro
Metadata
Metadata
Assignees
Labels
No labels