UNPKG

authrix

Version:

Lightweight, flexible authentication library for Node.js and TypeScript.

1 lines 584 B
import {a}from'./chunk-5VQXQYKM.mjs';export{a as AuthrixError,b as BadRequestError,f as ConflictError,d as ForbiddenError,g as InternalServerError,e as NotFoundError,c as UnauthorizedError}from'./chunk-5VQXQYKM.mjs';import'./chunk-3SAEGOMQ.mjs';function x(r,o,e=200){let s={success:true,data:o};r.status(e).json(s);}function t(r,o,e=500){let s={success:false,error:{message:o}};r.status(e).json(s);}function f(r,o,e,s){return r instanceof a?t(e,r.message,r.statusCode):t(e,"An unexpected internal server error occurred.",500)}export{f as errorHandler,t as sendError,x as sendSuccess};