UNPKG

@lunora/cli

Version:

The Lunora CLI: init, dev, deploy, codegen, migrate, seed, doctor, insights, logs, registry, and the rest of the project commands

3 lines (2 loc) • 785 B
import{resolveHint as d,isLunoraError as s,flattenHint as r}from"@lunora/errors";import{VisulimaError as m,renderError as f}from"@visulima/error";import{exitCodeForError as l}from"./EXIT_CODE-DVjUgIaG.mjs";const g={filterStacktrace:()=>!1,hideErrorCodeView:!0},w=(n,i={})=>{const t=n instanceof Error?n.message:String(n),o=d(s(n)?{code:n.code,hint:n.hint,message:t}:t),e=o===void 0?[]:r(o).split(` `),h=s(n)&&typeof n.why=="string"?[`Why: ${n.why}`]:[];s(n)&&(e.length>0&&e.push(""),e.push(`\`${n.code}\` — exits ${String(l(n))}. Run \`lunora docs exit-codes\` for the table.`));const a=[...h,...e],c=new m({hint:a.length===0?void 0:a,message:i.reason===void 0?t:`${i.reason}: ${t}`,name:n instanceof Error&&n.name.length>0?n.name:"Error"});return c.stack="",f(c,g)};export{w as r};