mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-25 10:24:13 +00:00
17 lines
403 B
JavaScript
17 lines
403 B
JavaScript
|
|
|
||
|
|
function AssertionError(message) {
|
||
|
|
var instance = new Error(message);
|
||
|
|
instance.name = 'AssertionError';
|
||
|
|
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
|
||
|
|
return instance;
|
||
|
|
}
|
||
|
|
|
||
|
|
function assert(value) {
|
||
|
|
if (!value)
|
||
|
|
throw new AssertionError("The assertion failed!");
|
||
|
|
}
|
||
|
|
|
||
|
|
function assertNotReached() {
|
||
|
|
throw new AssertionError("assertNotReached() was reached!");
|
||
|
|
}
|