The error object contains several properties that you can use. One property that you can use to receive an error message is .message , as in:
catch(err) { alert(err.message); }
The .name property returns the type of error, as in:
catch(err) { x = err.name; // ... do something based on value of x }
The name describes the type of error, and the .name value can be: EvalError, RangeError, ReferenceError, SyntaxError, TypeError and URIError . You can solve this error differently, depending on the type of error returned by the .name property.
A good tutorial can be found on JavaScriptKit . This is also an article about the bug object in the Mozilla Developer Network .
source share