From db50583dc2c7e41ec1a22e18f843e65eafd6b29a Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 7 Sep 2023 19:39:14 -0400 Subject: [PATCH] refactor: remove err --- src/err.ts | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 src/err.ts diff --git a/src/err.ts b/src/err.ts deleted file mode 100644 index c62766e..0000000 --- a/src/err.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { objAsString } from "./objAsString.js"; -import { ErrTuple } from "#types.js"; - -// addContextToErr is a helper function that standardizes the formatting of -// adding context to an error. -// -// NOTE: To protect against accidental situations where an Error type or some -// other type is provided instead of a string, we wrap both of the inputs with -// objAsString before returning them. This prevents runtime failures. -function addContextToErr(err: any, context: string): string { - if (err === null || err === undefined) { - err = "[no error provided]"; - } - return objAsString(context) + ": " + objAsString(err); -} - -export { addContextToErr };