如果捕获到特定异常 return 在抛出异常的行下方进行编码
if specific exception is caught return to code below the line where it was thrown
这可能很愚蠢,但是,是否可以捕获特定的异常,然后 return 到函数中抛出异常的位置?
例如
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
}
这可能很愚蠢,但是,是否可以捕获特定的异常,然后 return 到函数中抛出异常的位置?
例如
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
}