import { fromObject } from "https://deno.land/x/ayonli_jsext@v0.9.72/error/index.ts";
Reverses a plain object to a specific error type.
Examples
Example 1
Example 1
import { fromObject } from "@ayonli/jsext/error";
const obj = {
"@@type": "Error",
name: "Error",
message: "Something went wrong.",
stack: "Error: Something went wrong.\n at <anonymous>:1:13"
};
const err = fromObject(obj);
console.log(err);
// Error: Something went wrong.
// at <anonymous>:1:13
Parameters
obj: T
Parameters
optional
ctor: Constructor<Error>