@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 822 B
JavaScript
import{copy as e}from"../../libs/i18n/copy.mjs";import t from"../../constants/constants.mjs";import n from"./error-type-defaults.mjs";import{translate as r}from"../../libs/i18n/translate.mjs";var i=class i extends Error{error;constructor(e){super(r(e.message)??t.errors.message),this.error=e,e.zod!==void 0&&(this.error.errors=i.formatZodErrors(e.zod?.issues||[]));let a=n(e);this.error.status=a.status,this.error.name=a.name,this.error.message=a.message,this.name=r(this.error.name)??t.errors.message,this.message=r(this.error.message)??t.errors.message}static formatZodErrors(t){let n={};for(let r of t){let t=n;for(let e of r.path)typeof e==`number`&&(t=t.children||=[]),t=t[e]||(t[e]={});t.code=r.code,t.message=e.literal(r.message)}return n??void 0}};export{i as default};
//# sourceMappingURL=lucid-api-error.mjs.map