【发布时间】:2016-06-06 16:05:36
【问题描述】:
我想捕捉许多语句可能引发的错误,不必在每个语句的开头写“try”。
我写的:
do {
try couldThrowException1()
try couldThrowException2()
try couldThrowException3()
} catch {
handleExceptions()
}
我想怎么写:
do {
couldThrowException1()
couldThrowException2()
couldThrowException3()
} catch {
handleExceptions()
}
【问题讨论】:
标签: ios iphone swift error-handling try-catch