Skip to content

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