If I call hello.f
, the compiler forces me to handle all the thrown exceptions. I can swallow them using try?
or add a catch
all by not specifying the type of exception to catch and then re-throw. But, if I do the latter, I need to mark the calling function as throws and the process continues all the way up the stack.
Is it possible to ignore f
's exceptions such that they ultimately become un-handled exceptions that can be handled globally?
enum e : Error {
case hello
case world
}
class hello {
func f() throws {
throw e.hello
}
}