Movatterモバイル変換


[0]ホーム

URL:


Wayback Machine
45 captures
04 Jul 2007 - 01 Dec 2024
OctNOVDec
04
201320142015
success
fail
COLLECTED BY
Organization:Alexa Crawls
Starting in 1996,Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to theWayback Machine after an embargo period.
Collection:Alexa Crawls
Starting in 1996,Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to theWayback Machine after an embargo period.
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20141104204221/http://www.aptana.com:80/reference/html/api/Error.html

Error :Object

Represents a runtime error.

Browser/User Agent Support

IEMozillaNetscapeOperaSafari
5.0+1.0+6.0+7.0+1.0+

Constructors

ConstructorIEMozillaNetscapeOperaSafari
Constructs a new instance of an Error object.
5.0+1.0+6.0+7.0+1.0+
 

Properties

PropertyIEMozillaNetscapeOperaSafari
Specifies the function that creates the Error prototype.
5.0+1.0+6.0+7.0+1.0+
 
Description or message text of the error.
5.0+nononono
 
Path or URL to the file that raised the error.
no1.0+6.0+nono
 
Line number in file that raised the error.
no1.0+6.0+nono
 
Error message.
5.5+1.0+6.0+7.0+1.0+
 
Error name.
5.5+1.0+6.0+7.0+1.0+
 
Error number.
5.0+nononono
 
Reference to the Error object prototype.
5.0+1.0+6.0+7.0+1.0+
 
Stack trace that gives information about the context of the error.
5.0+1.0+6.0+nono
 

Methods

MethodIEMozillaNetscapeOperaSafari
Converts an Error object to a string.
5.0+1.0+6.0+7.0+1.0+
 

Throwing a generic error

Usually you create an Error object with the intention of raising it using the throw keyword. You can handle the error using the try...catch construct:

try {    throw new Error("Whoops!");} catch (e) {    alert(e.name + ": " + e.message);}

Handling a specific error

You can choose to handle only specific error types by testing the error type with the instanceof keyword:

try {    foo.bar();} catch (e) {    if (e instanceof EvalError) {        alert(e.name + ": " + e.message);    } else if (e instanceof RangeError) {        alert(e.name + ": " + e.message);    }    // ... etc}

You can also test the error'sname property to determine the error type. You can use this facility to create "user-defined" error types:

try {    var error = new Error("Whoops!");    error.name = "MyError";    throw error;} catch (e) {    if (e.name == "EvalError") {        alert(e.name + ": " + e.message);    } else if (e.name == "RangeError") {        alert(e.name + ": " + e.message);    }    // ... etc    else if (e.name == "MyError") {        alert(e.name + ": " + e.message);    }}

Remarks

Besides the baseError, there are six other core error types in JavaScript 1.5:

References

EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError

Availability

JavaScript 1.5 | JScript 5.5 | ECMAScript v3

Constructor Detail

Error Error([String message])

Constructs a new instance of an Error object.

StringmessageError message. (optional)

Property Detail

Object constructor -  only

Specifies the function that creates the Error prototype.

Availability

JavaScript 1.5 | JScript 5.0 | ECMAScript v3

 String description -  only

Description or message text of the error.

Availability

JScript 5.0

 String fileName -  only

Path or URL to the file that raised the error.

Availability

JavaScript 1.5

 Number lineNumber -  only

Line number in file that raised the error.

Availability

JavaScript 1.5

String message

Error message.

Availability

JavaScript 1.5 | JScript 5.5 | ECMAScript v3

String name

Error name.

Availability

JavaScript 1.5 | JScript 5.5 | ECMAScript v3

 Number number -  only

Error number.

Availability

JScript 5.0

 Object prototype -  only

Reference to the Error object prototype.

Availability

JavaScript 1.5 | JScript 5.0 | ECMAScript v3

 String stack -  only

Stack trace that gives information about the context of the error.

Availability

JavaScript 1.5

Method Detail

toString() : String

Converts an Error object to a string.

Availability

JavaScript 1.5 | JScript 5.5 | ECMAScript v3


[8]ページ先頭

©2009-2025 Movatter.jp