mirror of https://github.com/tc39/test262.git
30 lines
757 B
JavaScript
30 lines
757 B
JavaScript
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
/*---
|
|
description: |
|
|
Provides both:
|
|
|
|
- An error class to avoid false positives when testing for thrown exceptions
|
|
- A function to explicitly throw an exception using the Test262Error class
|
|
defines: [Test262Error, $ERROR, $DONOTEVALUATE]
|
|
---*/
|
|
|
|
|
|
function Test262Error(message) {
|
|
this.message = message || "";
|
|
}
|
|
|
|
Test262Error.prototype.toString = function () {
|
|
return "Test262Error: " + this.message;
|
|
};
|
|
|
|
Test262Error.thrower = (...args) => {
|
|
throw new Test262Error(...args);
|
|
};
|
|
|
|
var $ERROR = Test262Error.thrower;
|
|
|
|
function $DONOTEVALUATE() {
|
|
throw "Test262: This statement should not be evaluated.";
|
|
}
|