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

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -