@xentium/errors
v1.0.0-alpha.2
Published
XentiumError, the XEC code registry, and the Express error middleware.
Readme
@xentium/errors
Errors for the Xentium framework.
XentiumError, the XEC code registry, and the Express error middleware that
turns anything thrown during a request into one response shape:
{ "error": { "code": "XEC-API-4004", "message": "Not found", "severity": "warn" } }The middleware is a factory — an application injects whether it is production, where a log line goes, and where an error record is stored:
import { createErrorMiddleware } from "@xentium/errors";
app.use(createErrorMiddleware({
isProd,
logger,
persist: (entry) => db.errorLog.create({ data: entry }), // optional
}));persist is optional: an application with no error-log table is a legitimate
consumer.
Part of the Xentium framework. Xentium is a framework with the Xentium CMS as its first application.
MIT © Slaxxer
