AssertionError
import { AssertionError } from "jsr:@ende/assert";class
class AssertionError extends ErrorError thrown when an assertion fails.
Example: Usage
import { AssertionError } from "@ende/assert";
try {
throw new AssertionError("foo", { cause: "bar" });
} catch (error) {
if (error instanceof AssertionError) {
error.message === "foo"; // true
error.cause === "bar"; // true
}
}
Constructors
constructor
new AssertionError(message: string, options?: ErrorOptions)Constructs a new instance.
message: stringThe error message.
options?: ErrorOptionsAdditional options. This argument is still unstable. It may change in the future release.