Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CancellationError causes information loss #140

Open
wkornewald opened this issue Feb 25, 2025 · 0 comments
Open

CancellationError causes information loss #140

wkornewald opened this issue Feb 25, 2025 · 0 comments
Assignees

Comments

@wkornewald
Copy link

wkornewald commented Feb 25, 2025

When throwing any subclass of CancellationException from Kotlin, SKIE converts that to CancellationError and the information about the original Kotlin exception gets lost because CancellationError is just a struct and can't be subclassed. However, any other Kotlin exception gets preserved correctly.

Now we have the problem that our code uses subclasses of CancellationException to signal different kinds of cancellation. This is incompatible with how SKIE converts everything, including our custom subclasses into a general CancellationError that becomes useless as a signal.

Could you please either not convert every CancellationException into CancellationError or at least make it possible to turn the conversion feature on/off?

Another lossyness example: Kotlin code calls an interface which gets implemented by Swift and itself calls a Kotlin function. If the inner Kotlin function throws a specific CancellationException subtype and that becomes CancellationError in Swift and gets re-thrown, then the outer Kotlin code won't know what the original exception was.

@wkornewald wkornewald changed the title CancellationError is lossy CancellationError causes information loss Feb 25, 2025
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

No branches or pull requests

2 participants