Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions test/built-ins/Error/prototype/toString/tostring-get-throws.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (C) 2026 Garham Lee. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-error.prototype.tostring
description: >
Error.prototype.toString should throw when name or message getter throws
info: |
Error.prototype.toString ( )

1. Let _O_ be the *this* value.

3. Let _name_ be ? Get(_O_, *"name"*).

5. Let _msg_ be ? Get(_O_, *"message"*).
---*/
//Check #1
assert.throws(Test262Error, function() {
Error.prototype.toString.call({get name () {throw new Test262Error;}});
}, "name field getter should throw to cover abrupt completion return case in step 3")

//Check #2
assert.throws(Test262Error, function() {
Error.prototype.toString.call({get message () {throw new Test262Error;}});
}, "message field getter should throw to cover abrupt completion return case in step 5")