import { formatError } from "https://deno.land/x/libauth@v2.0.0-alpha.9/src/lib/format/error.ts";
A simple method used throughout Libauth to format error messages. By
formatting errors this way, downstream consumers can detect specific error
types by matching the errorType
. For example, the error:
formatError(SomeTypeOfError.exceedsMaximum, `Provided value: ${value}`);
Can be detected with String.includes()
, even if the
SomeTypeOfError.exceedsMaximum
error message changes:
error.includes(SomeTypeOfError.exceedsMaximum);
// => true
Using this method ensures consistency across the library.