gossamer/error_event

Types

An Event reporting an error during script execution or resource loading. Dispatched on EventTargets for the "error" event type.

See ErrorEvent on MDN.

pub type ErrorEvent
pub type ErrorEventInit(a) {
  Bubbles(Bool)
  Cancelable(Bool)
  Composed(Bool)
  Message(String)
  Filename(String)
  Lineno(Int)
  Colno(Int)
  Value(a)
}

Constructors

  • Bubbles(Bool)
  • Cancelable(Bool)
  • Composed(Bool)
  • Message(String)
  • Filename(String)
  • Lineno(Int)
  • Colno(Int)
  • Value(a)

The data carried by an ErrorEvent. Inherited Event properties (type, bubbles, cancelable, etc.) are reachable via to_event and the functions in gossamer/event.

pub type Fields {
  Fields(
    message: String,
    filename: String,
    lineno: Int,
    colno: Int,
    error: option.Option(dynamic.Dynamic),
  )
}

Constructors

Values

pub fn colno(of event: ErrorEvent) -> Int
pub fn error(
  of event: ErrorEvent,
) -> Result(dynamic.Dynamic, Nil)

Returns the error value associated with the event, or an error if none was provided.

pub fn filename(of event: ErrorEvent) -> String
pub fn lineno(of event: ErrorEvent) -> Int
pub fn message(of event: ErrorEvent) -> String
pub fn new(type_: String) -> ErrorEvent

Creates a new ErrorEvent with the given type.

pub fn new_with(
  type_: String,
  with init: List(ErrorEventInit(a)),
) -> ErrorEvent

Creates a new ErrorEvent with the given type and initialization options.

pub fn to_event(event: ErrorEvent) -> event.Event

Converts an ErrorEvent to a base Event for use with functions in gossamer/event.

pub fn to_fields(event: ErrorEvent) -> Fields
Search Document