mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
d102a10235
* refactor: import from `@std/assert` * update
31 lines
689 B
TypeScript
31 lines
689 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
// This module is browser compatible.
|
|
|
|
/**
|
|
* Error thrown when an assertion fails.
|
|
*
|
|
* @example Usage
|
|
* ```ts no-eval
|
|
* import { AssertionError } from "@std/assert";
|
|
*
|
|
* throw new AssertionError("Assertion failed");
|
|
* ```
|
|
*/
|
|
export class AssertionError extends Error {
|
|
/** Constructs a new instance.
|
|
*
|
|
* @example Usage
|
|
* ```ts no-eval
|
|
* import { AssertionError } from "@std/assert";
|
|
*
|
|
* throw new AssertionError("Assertion failed");
|
|
* ```
|
|
*
|
|
* @param message The error message.
|
|
*/
|
|
constructor(message: string) {
|
|
super(message);
|
|
this.name = "AssertionError";
|
|
}
|
|
}
|