try-catch-finally

try{
    // do sth 代码块
    throw 'test' //抛出异常
} catch(ex){
    //抛出异常时执行的语句,没有抛出异常不执行
} finally {
    //无论是否抛出异常,都执行该代码块的语句
}

标题名称:try-catch-finally
文章来源:http://myzitong.com/article/geehdp.html