4 Commits

Author SHA1 Message Date
36d26f6ff8 1.0.12 2021-08-19 18:42:52 +02:00
cbbf90f6f1 fix(core): update 2021-08-19 18:42:52 +02:00
935ea4386c 1.0.11 2021-08-19 18:40:04 +02:00
df430fa033 fix(core): update 2021-08-19 18:40:04 +02:00
3 changed files with 14 additions and 4 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@pushrocks/smartstatus",
"version": "1.0.10",
"version": "1.0.12",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@pushrocks/smartstatus",
"version": "1.0.10",
"version": "1.0.12",
"license": "MIT",
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartstatus",
"version": "1.0.10",
"version": "1.0.12",
"private": false,
"description": "status information in TypeScript",
"main": "dist_ts/index.js",

View File

@ -6,7 +6,17 @@ export class HttpStatus {
HttpStatus.statusMap[statusStringArg] = statusArg;
}
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;
}
public code: number;