improve status
This commit is contained in:
parent
9ef2d0bd17
commit
9e3b6a59cb
5
dist/grip.js
vendored
5
dist/grip.js
vendored
|
@ -32,7 +32,7 @@ class Err extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
class Ok extends Error {
|
||||
class Ok {
|
||||
Ok() {
|
||||
return true;
|
||||
}
|
||||
|
@ -42,6 +42,9 @@ class Ok extends Error {
|
|||
Of(cls) {
|
||||
return this instanceof cls;
|
||||
}
|
||||
toString() {
|
||||
return "Ok";
|
||||
}
|
||||
}
|
||||
|
||||
class Result extends Array {
|
||||
|
|
9
grip.ts
9
grip.ts
|
@ -1,4 +1,6 @@
|
|||
interface Status extends Error {
|
||||
interface Status {
|
||||
message?: string;
|
||||
cause?: any;
|
||||
Ok(): boolean;
|
||||
Fail(): boolean;
|
||||
Of(cls: any): boolean;
|
||||
|
@ -22,7 +24,7 @@ export class Err extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
export class Ok extends Error {
|
||||
export class Ok {
|
||||
Ok() {
|
||||
return true;
|
||||
}
|
||||
|
@ -32,6 +34,9 @@ export class Ok extends Error {
|
|||
Of(cls: any) {
|
||||
return this instanceof cls;
|
||||
}
|
||||
toString() {
|
||||
return "Ok";
|
||||
}
|
||||
}
|
||||
|
||||
interface IResult<T> {
|
||||
|
|
Loading…
Reference in a new issue