Error.toString()

Availability

Flash Player 7.

Usage

myError.toString()

Parameters

myError An instance of the Error object.

Returns

A string.

Description

Method; returns the string "Error" by default, or the value contained in Error.message, if defined.

Example

In this example, an attempt is made to connect

var sock = new XMLSocket();
try {
  // Try to connect to server, throwing exception
  // if it fails.
  if (!sock.connect("www.mybiz.com", 8080)) {
    throw new Error("Couldn't connect socket.");
  }
  // Display success message in text field.
  outField = "Connection in progress...";
} catch (e) {
  // Display error message in text field.
  outField = e.toString();
}

See also

throw, try..catch..finally