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

x/ayonli_jsext/error/index.ts>fromErrorEvent

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

Creates an error instance based on the given ErrorEvent instance.

Examples

Example 1

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

const event = new ErrorEvent("error", {
    message: "Something went wrong.",
    filename: "",
    lineno: 1,
    colno: 13,
});

const err = fromErrorEvent(event);
console.log(err);
// Error: Something went wrong.
//     at <anonymous>:1:13

Type Parameters

T extends Error

Returns

T | null