Sylvain Patenaude
02/28/2020, 2:46 PMHolger Steinhauer [Mod]
02/28/2020, 3:36 PMkotlin.jvm
package. So no import should be needed. Do you have a valid Kotlin configuration?Sylvain Patenaude
02/28/2020, 3:42 PMHolger Steinhauer [Mod]
02/28/2020, 3:42 PMSylvain Patenaude
02/28/2020, 4:11 PMrobin
02/28/2020, 5:08 PM@Throws(Exception::class)
, which will allow any exception to be thrown, since in Java, every checked exception is a subclass of Exception
.Sylvain Patenaude
02/28/2020, 5:35 PMrobin
02/28/2020, 5:47 PMThrows
is actually not just one exception class, but an array of exception classes, all of which the function may throw. From that definition, I'd guess that giving the annotation no Exception classes means "The list of exception classes this function can throw is empty), which would just mean the same as "This function does not throw any exceptions", so in effect just does nothing.Sylvain Patenaude
02/28/2020, 8:32 PMkpgalligan
02/28/2020, 8:40 PMError
and `RuntimeException`are unchecked, and intend to signal that things are super not OK. Error
I understand, as if you get OOM or a stack overflow, you’re probably not going to be able to catch or deal with them. RuntimeException
is debatable, but I guess you’ll need a wrapper. Swift/objc don’t really do this as much. If you had range issues in objc you’d definitely need to be dealing with them prospectively. If you absolutely need to let `IndexOutOfBoundsException`throw rather than range check first, you’ll need a try/catch at the Kotlin/Objc border I guess.Sylvain Patenaude
02/28/2020, 8:42 PMkpgalligan
02/28/2020, 8:45 PM@Throws(OurWrapperException::class)
fun someKotlinThing(){
try{
//Dangerous code
} catch (t:Throwable){
throw OurWrapperException(t)
}
}
kpgalligan
02/28/2020, 8:45 PMkpgalligan
02/28/2020, 8:46 PMSylvain Patenaude
02/28/2020, 8:46 PMkpgalligan
02/28/2020, 8:47 PMSylvain Patenaude
03/02/2020, 5:39 PMkpgalligan
03/02/2020, 6:10 PMkpgalligan
03/02/2020, 6:11 PMSylvain Patenaude
03/02/2020, 6:19 PMkpgalligan
03/02/2020, 6:22 PMSylvain Patenaude
03/02/2020, 6:58 PMpackage com.mycompany.mysdk.exceptions
class ParsingException(innerException: Throwable) : Exception(innerException) {
}
Sylvain Patenaude
03/03/2020, 5:31 PM