Anyone have an automated way (plugin or lint rule?...
# kotlin-native
a
Anyone have an automated way (plugin or lint rule?) to enforce that public methods are either • annotated with @Throws for iOS, or • intentionally not annotated (either with an ignore, or maybe a different annotation)? We aggressively use `check`/`require` to validate method inputs, and it’s a pain when we encounter it and don't get a catchable exception on iOS 😅
m
Should be easy enough to create a custom detekt rule for this. I've made one in the past requiring the android thread annotations. Personally, I don't think you should be catching exceptions thrown by
check
or
require
. They indicate that a bug and that the app is in a bad state. Trying to keep going when you don't know why you are in an unexpected state is dangerous. Also if you use those a lot, and then annotate all the functions that call them with
@Throws
you will have an API that is very hard to use from iOS, since you are forced to handle exceptions that are bugs and should not happen.