Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/esm/error/index.js>toErrorEvent

A JavaScript extension package for building strong and modern applications.
Latest
function toErrorEvent
import { toErrorEvent } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/error/index.js";

Creates an ErrorEvent instance based on the given error.

Examples

Example 1

import { toErrorEvent } from "@ayonli/jsext/error";

const err = new Error("Something went wrong.");

const event = toErrorEvent(err);
console.log(event);
// ErrorEvent {
//     error: Error: Something went wrong.
//         at <anonymous>:1:13,
//     message: "Something went wrong.",
//     filename: "",
//     lineno: 1,
//     colno: 13
// }

Parameters

err
optional
type = [UNSUPPORTED]