2017-07-14 17:37:24 +02:00
|
|
|
// 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
|
2021-07-29 21:38:45 +02:00
|
|
|
defines: [Test262Error, $DONOTEVALUATE]
|
2017-07-14 17:37:24 +02:00
|
|
|
---*/
|
|
|
|
|
2017-04-13 16:37:32 +02:00
|
|
|
|
|
|
|
function Test262Error(message) {
|
|
|
|
this.message = message || "";
|
|
|
|
}
|
|
|
|
|
|
|
|
Test262Error.prototype.toString = function () {
|
|
|
|
return "Test262Error: " + this.message;
|
|
|
|
};
|
|
|
|
|
2021-07-02 15:04:13 +02:00
|
|
|
Test262Error.thrower = (message) => {
|
|
|
|
throw new Test262Error(message);
|
2017-04-13 16:37:32 +02:00
|
|
|
};
|
2020-09-16 20:38:39 +02:00
|
|
|
|
2018-10-11 16:59:24 +02:00
|
|
|
function $DONOTEVALUATE() {
|
2018-09-27 01:18:22 +02:00
|
|
|
throw "Test262: This statement should not be evaluated.";
|
|
|
|
}
|