refactor: remove err

This commit is contained in:
Derrick Hammer 2023-09-07 19:39:14 -04:00
parent 2c6b8438e1
commit db50583dc2
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 0 additions and 17 deletions

View File

@ -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 };