Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
e699f8a634 | |||
c7dd91e9cd |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.15.1",
|
"version": "0.15.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.15.1",
|
"version": "0.15.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.12",
|
"@types/jest": "^29.5.12",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.15.2",
|
"version": "0.15.3",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -53,6 +53,18 @@ export class UnauthorizedError extends CustomError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class PaymentRequiredError extends CustomError {
|
||||||
|
static code = 402;
|
||||||
|
|
||||||
|
constructor(message: string = 'Payment Required') {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static instanceof(err: Error) {
|
||||||
|
return (<any>err).constructor.code == this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class ForbiddenError extends CustomError {
|
export class ForbiddenError extends CustomError {
|
||||||
static code = 403;
|
static code = 403;
|
||||||
|
|
||||||
@ -77,6 +89,30 @@ export class NotFoundError extends CustomError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class MethodNotAllowedError extends CustomError {
|
||||||
|
static code = 405;
|
||||||
|
|
||||||
|
constructor(message: string = 'Method Not Allowed') {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static instanceof(err: Error) {
|
||||||
|
return (<any>err).constructor.code == this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class NotAcceptableError extends CustomError {
|
||||||
|
static code = 406;
|
||||||
|
|
||||||
|
constructor(message: string = 'Not Acceptable') {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static instanceof(err: Error) {
|
||||||
|
return (<any>err).constructor.code == this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class InternalServerError extends CustomError {
|
export class InternalServerError extends CustomError {
|
||||||
static code = 500;
|
static code = 500;
|
||||||
|
|
||||||
@ -88,3 +124,51 @@ export class InternalServerError extends CustomError {
|
|||||||
return (<any>err).constructor.code == this.code;
|
return (<any>err).constructor.code == this.code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class NotImplementedError extends CustomError {
|
||||||
|
static code = 501;
|
||||||
|
|
||||||
|
constructor(message: string = 'Not Implemented') {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static instanceof(err: Error) {
|
||||||
|
return (<any>err).constructor.code == this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class BadGatewayError extends CustomError {
|
||||||
|
static code = 502;
|
||||||
|
|
||||||
|
constructor(message: string = 'Bad Gateway') {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static instanceof(err: Error) {
|
||||||
|
return (<any>err).constructor.code == this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ServiceUnavailableError extends CustomError {
|
||||||
|
static code = 503;
|
||||||
|
|
||||||
|
constructor(message: string = 'Service Unavailable') {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static instanceof(err: Error) {
|
||||||
|
return (<any>err).constructor.code == this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GatewayTimeoutError extends CustomError {
|
||||||
|
static code = 504;
|
||||||
|
|
||||||
|
constructor(message: string = 'Gateway Timeout') {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static instanceof(err: Error) {
|
||||||
|
return (<any>err).constructor.code == this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user