24 lines
440 B
TypeScript
24 lines
440 B
TypeScript
|
import http from '@scode/consts';
|
||
|
|
||
|
export default class Status {
|
||
|
private _status = -1;
|
||
|
|
||
|
public get status (): number {
|
||
|
if (this._status === -1)
|
||
|
throw new Error ('status undefined');
|
||
|
return this._status;
|
||
|
}
|
||
|
|
||
|
public set status (value: number): void {
|
||
|
this._status = value;
|
||
|
}
|
||
|
|
||
|
public get has_status (): boolean {
|
||
|
return this._status !== -1;
|
||
|
}
|
||
|
|
||
|
public ok (): void {
|
||
|
this._status = http.status_ok;
|
||
|
}
|
||
|
}
|