improve status

This commit is contained in:
Anton Nesterov 2024-10-16 08:18:40 +02:00
parent 9ef2d0bd17
commit 9e3b6a59cb
No known key found for this signature in database
GPG key ID: 59121E8AE2851FB5
2 changed files with 11 additions and 3 deletions

5
dist/grip.js vendored
View file

@ -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 {

View file

@ -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> {