Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
36d26f6ff8 | |||
cbbf90f6f1 | |||
935ea4386c | |||
df430fa033 | |||
acbe290526 | |||
98f99bd18d |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartstatus",
|
"name": "@pushrocks/smartstatus",
|
||||||
"version": "1.0.9",
|
"version": "1.0.12",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pushrocks/smartstatus",
|
"name": "@pushrocks/smartstatus",
|
||||||
"version": "1.0.9",
|
"version": "1.0.12",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@gitzone/tsbuild": "^2.1.25",
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartstatus",
|
"name": "@pushrocks/smartstatus",
|
||||||
"version": "1.0.9",
|
"version": "1.0.12",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "status information in TypeScript",
|
"description": "status information in TypeScript",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "tsbuild"
|
"build": "tsbuild --web"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -6,7 +6,17 @@ export class HttpStatus {
|
|||||||
HttpStatus.statusMap[statusStringArg] = statusArg;
|
HttpStatus.statusMap[statusStringArg] = statusArg;
|
||||||
}
|
}
|
||||||
public static getHttpStatusByString(codeStringArg: string): HttpStatus {
|
public static getHttpStatusByString(codeStringArg: string): HttpStatus {
|
||||||
const statusInstance = new HttpStatus.statusMap[codeStringArg]();
|
let statusInstance: HttpStatus;
|
||||||
|
try {
|
||||||
|
statusInstance = new HttpStatus.statusMap[codeStringArg]();
|
||||||
|
} catch {
|
||||||
|
console.log('unknown status')
|
||||||
|
return new HttpStatus({
|
||||||
|
code: 0,
|
||||||
|
text: 'unknown status',
|
||||||
|
description: `The status ${codeStringArg} is not known.`
|
||||||
|
});
|
||||||
|
}
|
||||||
return statusInstance;
|
return statusInstance;
|
||||||
}
|
}
|
||||||
public code: number;
|
public code: number;
|
||||||
|
Reference in New Issue
Block a user