这可能很愚蠢,但是,是否可以捕获特定的异常,然后在一行之后返回到函数中抛出异常的位置?
例如
Try
{
//trigger exception
//return to function here
//more function
}
catch(Exception e)
{
if (e.Message.Contains("exception message contents"))
{Do the return thing}
}
没有什么能阻止你在尝试中尝试。。
try{
//some code
try{ couldGoBoom(); } catch (SomeException) { ... }
//code you want to "return to"'after the SomeException is done with
} catch(OtherException){
//etc
}