Core JavaScript 1.5 Reference:Global Objects:Error:name
From MDC
Contents |
[edit] Summary
A name for the type of error.
[edit] Description
By default, Error instances are given the name "Error". The name property, in addition to the message property, is used by the Error.prototype.toString method to create a string representation of the error.
[edit] Examples
[edit] Example: Throwing a custom error
var e = new Error("Malformed input"); // e.name is "Error"
e.name = "ParseError"; // e.toString() would return
throw e; // "ParseError: Malformed input"