• Indicates the error object
-Evalerror, urierror, rangeerror, etc.
• Capture method:
-Try {... Throw new error (...) } Catch (e ){... }
-In theory, throw can be used as the intended object.
• Public attributes of the error object IE and Firefox
-Message: error message
Error browser-specific attributes
• Ie:
-Description: Same as message Property
-Number: error number. This attribute is available only for errors thrown by the script engine.
• Firefox:
-Filename: creates an incorrect file.
-Linenumber: the row number of the error object.
-Stack: stack information when an error is created
Html <! Doctype HTML public " -// W3C // dtd xhtml 1.0 transitional // en " " Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
< HTML xmlns = " Http://www.w3.org/1999/xhtml " >
< Head >
< Title > Native Error Type </ Title >
< Script Language = " Javascript " Type = " Text/JavaScript " SRC = " Error. js " > </ Script >
</ Head >
< Body >
< Script Language = " Javascript " Type = " Text/JavaScript " >
Try
{
Throwerror ();
}
Catch (E)
{
VaR errormsg = ( " Message: " + E. Message + " \ N " );
If ( ! E. Stack) // IE
{
Errormsg + = ( " Description: " + E. Description + " \ N " );
Errormsg + = ( " Number: " + E. Number );
}
Else
{
Errormsg + = ( " Line number: " + E. linenumber + " \ N " );
Errormsg + = ( " File Name: " + E. filename + " \ N " );
Errormsg + = ( " Stack trace: \ n " + E. Stack );
}
Alert (errormsg );
}
</ Script >
</ Body >
</ Html >
error. JS function throwerror ()
{< br> throw New error ( " custom error " );
}
function getniceerror ()
{< br> var e = error. create ( " error message " ,
{custommessage: " Custom message " });
E. popstackframe ();
return E;
}