PR-URL: https://github.com/nodejs/node/pull/58070 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
27 lines
1.0 KiB
JavaScript
27 lines
1.0 KiB
JavaScript
// 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.
|
|
//
|
|
// Flags: --js-staging
|
|
|
|
(function TestSuppressedErrorAllParameters() {
|
|
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);
|
|
})();
|