import { assertError } from "https://deno.land/x/scaffold@0.3.0/src/deps/npm.ts";
Assert that the given value is an Error
.
If the value is not an Error
, a helpful TypeError
will be thrown.
This can be useful as any value could potentially be thrown, but in practice, it's always an Error
. However, because of this, TypeScript makes the caught error in a try/catch statement unknown
, which is inconvenient to deal with.