@fega01/app-error
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -20,1 +20,8 @@ export interface AppErrorObject { | ||
} | ||
/** | ||
* Common Errors | ||
*/ | ||
export declare const BAD_REQUEST: AppErrorObject; | ||
export declare const NOT_FOUND: AppErrorObject; | ||
export declare const UNAUTHORIZED: AppErrorObject; | ||
export declare const FORBIDDEN: AppErrorObject; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const http_status_1 = require("http-status"); | ||
/** | ||
@@ -20,2 +21,25 @@ * Example of error | ||
exports.AppError = AppError; | ||
/** | ||
* Common Errors | ||
*/ | ||
exports.BAD_REQUEST = { | ||
code: "BAD_REQUEST", | ||
status: http_status_1.BAD_REQUEST, | ||
message: "bad request" | ||
}; | ||
exports.NOT_FOUND = { | ||
code: "NOT_FOUND", | ||
status: http_status_1.NOT_FOUND, | ||
message: "Resource not found" | ||
}; | ||
exports.UNAUTHORIZED = { | ||
code: "UNAUTHORIZED", | ||
status: http_status_1.UNAUTHORIZED, | ||
message: "Unauthorized" | ||
}; | ||
exports.FORBIDDEN = { | ||
code: "FORBIDDEN", | ||
status: http_status_1.FORBIDDEN, | ||
message: "Access Denied" | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@fega01/app-error", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A nice controller based on Proxies", | ||
@@ -42,3 +42,5 @@ "main": "dist/index.js", | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"http-status": "^1.1.2" | ||
}, | ||
"nyc": { | ||
@@ -59,2 +61,2 @@ "extension": [ | ||
"types": "./dist/index.d.ts" | ||
} | ||
} |
@@ -0,2 +1,4 @@ | ||
import { BAD_REQUEST as BR, NOT_FOUND as NF, UNAUTHORIZED as UNA, FORBIDDEN as F } from "http-status"; | ||
export interface AppErrorObject { | ||
@@ -27,2 +29,27 @@ code: string; | ||
} | ||
} | ||
} | ||
/** | ||
* Common Errors | ||
*/ | ||
export const BAD_REQUEST: AppErrorObject = { | ||
code: "BAD_REQUEST", | ||
status: BR, | ||
message: "bad request" | ||
}; | ||
export const NOT_FOUND: AppErrorObject = { | ||
code: "NOT_FOUND", | ||
status: NF, | ||
message: "Resource not found" | ||
}; | ||
export const UNAUTHORIZED: AppErrorObject = { | ||
code: "UNAUTHORIZED", | ||
status: UNA, | ||
message: "Unauthorized" | ||
}; | ||
export const FORBIDDEN: AppErrorObject = { | ||
code: "FORBIDDEN", | ||
status: F, | ||
message: "Access Denied" | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8039
214
1
1
+ Addedhttp-status@^1.1.2
+ Addedhttp-status@1.8.1(transitive)