import { toObject } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/error/index.js";
Transforms the error to a plain object.
Examples
Example 1
Example 1
import { toObject } from "@ayonli/jsext/error";
const err = new Error("Something went wrong.");
const obj = toObject(err);
console.log(obj);
// {
// "@@type": "Error",
// name: "Error",
// message: "Something went wrong.",
// stack: "Error: Something went wrong.\n at <anonymous>:1:13"
// }