Jus*_*tin 25 javascript callstack exception-handling
在JavaScript中捕获/处理异常时,如何确定异常发生时调用堆栈的内容?(如果可能的话,行号是什么)
try
{
// etc...
}
catch (ex)
{
// At this point here I want to be able to print out a detailed exception
// message, complete with call stack, and if possible line numbers.
}
Run Code Online (Sandbox Code Playgroud)
jld*_*ont 14
看看这个.
一种分析可用信息的方法:
try
{
doInit();
} catch(err)
{
var vDebug = "";
for (var prop in err)
{
vDebug += "property: "+ prop+ " value: ["+ err[prop]+ "]\n";
}
vDebug += "toString(): " + " value: [" + err.toString() + "]";
status.rawValue = vDebug;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
26383 次 |
| 最近记录: |