firefox - Javascript try-catch error output truncated -
when attempting run following code:
try{ document.getelementsbyclassname("aklsdjfaskldf")[0].outerhtml; }catch(err){ alert("function failed error dump <"+err.message+">"); }
the error message displayed truncated:
function failed error dump <document.getelementsbyclassname(...)[0] undefined>
is there way error message displayed in full, i.e. display following message in firefox? chrome not display output, , therefore not issue current usage.
function failed error dump <document.getelementsbyclassname("aklsdjfaskldf")[0] undefined>
every browser handles error call stack differently, if on chrome wont see string. cannot invoke outerhtml function on undefined. better check value before invoking function on , show appropriate alert. or print error.stack if want hint location of code throwing error.
Comments
Post a Comment