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

Improve Exception to NSError conversion #31

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

rickclephas
Copy link
Owner

Fixes #29

@rickclephas
Copy link
Owner Author

The current implementation uses compiler internals which causes issues when the @Throws annotation is also used.
For this to work correctly we need a public API: https://youtrack.jetbrains.com/issue/KT-50539

fun IrDeclaration.getAnnotation(): IrConstructorCall? =
annotations.findNativeCoroutineThrowsAnnotation() ?:
useThrowsAnnotation.ifTrue { originalDeclaration.annotations.findThrowsAnnotation() } ?:
parentClassOrNull?.getAnnotation()
Copy link
Owner Author

Choose a reason for hiding this comment

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

Maybe this should just use all the annotations, would probably make more sense since the propagatedExceptions are also applied (even if the function has an annotation).

@rickclephas rickclephas force-pushed the feature/GH-29-improve-exception-conversion branch from 5bf1ea0 to fc884ee Compare February 20, 2022 13:02
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.

Improve Exception to NSError conversion
1 participant