Skip to content

Commit f767b4e

Browse files
authored
[js-api] Throw RangeError when getArg's index is out of bounds (#196)
Closes #184.
1 parent ca2b715 commit f767b4e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

document/js-api/index.bs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ The <dfn method for="Exception">getArg(|exceptionTag|, |index|)</dfn> method ste
13101310
1. Throw a {{TypeError}}.
13111311
1. Let |payload| be **this**.\[[Payload]].
13121312
1. If |index| ≥ |payload|'s [=list/size=],
1313-
1. Throw a {{TypeError}}.
1313+
1. Throw a {{RangeError}}.
13141314
1. Return [=ToJSValue=](|payload|[|index|]).
13151315

13161316
</div>

test/js-api/exception/getArg.tentative.any.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ test(() => {
4343
const tag = new WebAssembly.Tag({ parameters: [] });
4444
const exn = new WebAssembly.Exception(tag, []);
4545
for (const value of outOfRangeValues) {
46-
assert_throws_js(TypeError, () => exn.getArg(tag, value));
46+
assert_throws_js(RangeError, () => exn.getArg(tag, value));
4747
}
4848
}, "Getting out-of-range argument");
4949

0 commit comments

Comments
 (0)