2012-12-27 13 views

回答

0

JavaScript標準指出,一旦遇到未處理的異常,應用程序應停止執行。這意味着你的代碼在try(){...} catch(){}塊中產生了一個錯誤,這不是被捕獲。在try-catch塊包裝你的代碼來得到它的工作

E.G:

function raiseError(){ 
    //...Error-raising code here 
    throw new Error("Test Exception"); 
}; 

try{ 
    raiseError(); 
} 
catch(e){ 
    console.log("Error caught", e); 
} 
相關問題