UNPKG

next-expose

Version:

A fluent, type-safe API routing and middleware layer for the Next.js App Router.

2 lines (1 loc) 1.29 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class t extends Error{statusCode;payload;constructor(r,o,s=null){super(o),this.statusCode=r,this.payload=s,Object.setPrototypeOf(this,new.target.prototype)}}function n(e){return e instanceof t}class u extends t{constructor(r,o="Validation failed"){super(400,o,r)}}class c extends t{constructor(r="The request could not be understood or processed."){super(400,r)}}class a extends t{constructor(r="Authentication is required for this resource."){super(401,r)}}class i extends t{constructor(r="You are not authorized to perform this action."){super(403,r)}}class d extends t{constructor(r="The requested resource was not found."){super(404,r)}}class l extends t{constructor(r="A conflict occurred with the current state of the resource."){super(409,r)}}class p extends t{constructor(r="Too many requests, please try again later.",o=null){super(429,r,o)}}class E extends t{constructor(r="An unexpected internal server error occurred."){super(500,r)}}exports.ApiError=t;exports.AuthenticationError=a;exports.AuthorizationError=i;exports.BadRequestError=c;exports.ConflictError=l;exports.InternalServerError=E;exports.NotFoundError=d;exports.TooManyRequestsError=p;exports.ValidationError=u;exports.isApiError=n;