# Class WebErrorEvent

java.lang.Object
java.util.EventObject
javafx.event.Event
javafx.scene.web.WebErrorEvent

All Implemented Interfaces:
  `Serializable`, `Cloneable`

public final class WebErrorEvent extends Event
An event indicating a `WebEngine` error. Holds an optional text message and an optional exception associated with the error.

Since:
  JavaFX 8.0
See Also:
  - WebEngine.onError
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final EventType<WebErrorEvent>`
  `ANY`
  Common supertype for all `WebErrorEvent` types.
  `static final EventType<WebErrorEvent>`
  `USER_DATA_DIRECTORY_ALREADY_IN_USE`
  This event occurs when a `WebEngine` detects that its user data directory is already in use by a `WebEngine` running in a different VM.
  `static final EventType<WebErrorEvent>`
  `USER_DATA_DIRECTORY_IO_ERROR`
  This event occurs when a `WebEngine` encounters an I/O error while trying to create or access the user data directory.
  `static final EventType<WebErrorEvent>`
  `USER_DATA_DIRECTORY_SECURITY_ERROR`
  This event occurs when a `WebEngine` encounters a security error while trying to create or access the user data directory.

  ### Fields declared in class javafx.event.Event

  `consumed, eventType, NULL_SOURCE_TARGET, target`

  ### Fields declared in class java.util.EventObject

  `source`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WebErrorEvent(Object source, EventType<WebErrorEvent> type, String message, Throwable exception)`
  Creates a new `WebErrorEvent`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Throwable`
  `getException()`
  Returns the exception associated with this event.
  `String`
  `getMessage()`
  Returns the text message associated with this event.

  ### Methods declared in class javafx.event.Event

  `clone, consume, copyFor, fireEvent, getEventType, getTarget, isConsumed`

  ### Methods declared in class java.util.EventObject

  `getSource, toString`

  ### Methods declared in class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### ANY

    public static final EventType<WebErrorEvent> ANY
    Common supertype for all `WebErrorEvent` types.

  - ### USER_DATA_DIRECTORY_ALREADY_IN_USE

    public static final EventType<WebErrorEvent> USER_DATA_DIRECTORY_ALREADY_IN_USE
    This event occurs when a `WebEngine` detects that its user data directory is already in use by a `WebEngine` running in a different VM.

    In general, multiple `WebEngine` instances may share a single user data directory as long as they run in the same VM. `WebEngine` instances running in different VMs are not allowed to share the same user data directory.

    When a `WebEngine` is about to start loading a web page or executing a script for the first time, it checks whether its `userDataDirectory` is already in use by a `WebEngine` running in a different VM. If the latter is the case, the `WebEngine` invokes the `WebEngine.onError` event handler, if any, with a `USER_DATA_DIRECTORY_ALREADY_IN_USE` event. If the invoked event handler modifies the `userDataDirectory` property, the `WebEngine` retries with the new user data directory as soon as the handler returns. If the handler does not modify the `userDataDirectory` property (which is the default), the `WebEngine` continues without the user data directory.

  - ### USER_DATA_DIRECTORY_IO_ERROR

    public static final EventType<WebErrorEvent> USER_DATA_DIRECTORY_IO_ERROR
    This event occurs when a `WebEngine` encounters an I/O error while trying to create or access the user data directory.

    When a `WebEngine` is about to start loading a web page or executing a script for the first time, it checks whether it can create or access its `userDataDirectory`. If the check fails with an I/O error (such as `java.io.IOException`), the `WebEngine` invokes the `WebEngine.onError` event handler, if any, with a `USER_DATA_DIRECTORY_IO_ERROR` event. If the invoked event handler modifies the `userDataDirectory` property, the `WebEngine` retries with the new user data directory as soon as the handler returns. If the handler does not modify the `userDataDirectory` property (which is the default), the `WebEngine` continues without the user data directory.

  - ### USER_DATA_DIRECTORY_SECURITY_ERROR

    public static final EventType<WebErrorEvent> USER_DATA_DIRECTORY_SECURITY_ERROR
    This event occurs when a `WebEngine` encounters a security error while trying to create or access the user data directory.

    When a `WebEngine` is about to start loading a web page or executing a script for the first time, it checks whether it can create or access its `userDataDirectory`. If the check fails with a security error (such as `java.lang.SecurityException`), the `WebEngine` invokes the `WebEngine.onError` event handler, if any, with a `USER_DATA_DIRECTORY_SECURITY_ERROR` event. If the invoked event handler modifies the `userDataDirectory` property, the `WebEngine` retries with the new user data directory as soon as the handler returns. If the handler does not modify the `userDataDirectory` property (which is the default), the `WebEngine` continues without the user data directory.

- ## Constructor Details

  - ### WebErrorEvent

    public WebErrorEvent(Object source, EventType<WebErrorEvent> type, String message, Throwable exception)
    Creates a new `WebErrorEvent`.
    Parameters:
      `source` - the event source which sent the event
      `type` - the event type
      `message` - the text message associated with the event; may be `null`
      `exception` - the exception associated with the event; may be `null`

- ## Method Details

  - ### getMessage

    public String getMessage()
    Returns the text message associated with this event.
    Returns:
      the text message associated with this event, or `null` if there is no such message

  - ### getException

    public Throwable getException()
    Returns the exception associated with this event.
    Returns:
      the exception associated with this event, or `null` if there is no such exception