add catch error with check for known error

This commit is contained in:
Lucy Cifferello
2022-11-15 12:32:08 -05:00
parent 8630000e8c
commit bfa30da1f6
2 changed files with 11 additions and 1 deletions

View File

@@ -21,3 +21,6 @@ export const errorCode = (code: number, error: string) => ({
});
export const error = (error: string) => ({ error });
export const ok = { result: null };
// deno-lint-ignore no-explicit-any
export const isKnownError = (e: any): e is T.KnownError => e.error || e["error-code"]