From 9e3b6a59cb46ed1d8ec51a4bb5c86828c85c8553 Mon Sep 17 00:00:00 2001 From: Anton Nesterov Date: Wed, 16 Oct 2024 08:18:40 +0200 Subject: [PATCH] improve status --- dist/grip.js | 5 ++++- grip.ts | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dist/grip.js b/dist/grip.js index fe42fe5..55c2491 100644 --- a/dist/grip.js +++ b/dist/grip.js @@ -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 { diff --git a/grip.ts b/grip.ts index 24fbd1a..45faab1 100644 --- a/grip.ts +++ b/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 {