2024-03-30 09:54:35 +01:00
|
|
|
// Copyright 2023 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
//
|
2025-04-29 08:03:15 +02:00
|
|
|
// Flags: --js-staging
|
2024-03-30 09:54:35 +01:00
|
|
|
|
|
|
|
(function TestSuppressedErrorAllParameters() {
|
2024-09-17 12:09:47 +02:00
|
|
|
const firstError = new Error('First error');
|
|
|
|
const secondError = new Error('Second error');
|
|
|
|
let suppressedError =
|
|
|
|
new SuppressedError(secondError, firstError, 'Test error');
|
|
|
|
assertEquals(secondError, suppressedError.error);
|
|
|
|
assertEquals(firstError, suppressedError.suppressed);
|
|
|
|
assertEquals('Test error', suppressedError.message);
|
|
|
|
})();
|
|
|
|
|
|
|
|
(function TestSuppressedErrorNewTarget() {
|
|
|
|
class MySuppressedError extends SuppressedError {};
|
|
|
|
const firstError = new Error('First error');
|
|
|
|
const secondError = new Error('Second error');
|
|
|
|
let suppressedError =
|
|
|
|
new MySuppressedError(secondError, firstError, 'Test error');
|
|
|
|
assertEquals(secondError, suppressedError.error);
|
|
|
|
assertEquals(firstError, suppressedError.suppressed);
|
|
|
|
assertEquals("Test error", suppressedError.message);
|
2024-03-30 09:54:35 +01:00
|
|
|
})();
|