Skip to content

Commit 0631e21

Browse files
committed
harness/asyncHelpers.js: Isolate assert.throwsAsync failure conditions
1 parent b22b500 commit 0631e21

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

harness/asyncHelpers.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,24 @@ assert.throwsAsync = function (expectedErrorConstructor, func, message) {
6363
}
6464
try {
6565
innerThenable = func();
66-
if (
67-
innerThenable === null ||
68-
typeof innerThenable !== "object" ||
69-
typeof innerThenable.then !== "function"
70-
) {
71-
message +=
72-
"Expected to obtain an inner promise that would reject with a" +
73-
expectedErrorConstructor.name +
74-
" but result was not a thenable";
75-
throw new Test262Error(message);
76-
}
7766
} catch (thrown) {
7867
message +=
7968
"Expected a " +
8069
expectedErrorConstructor.name +
8170
" to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise";
8271
throw new Test262Error(message);
8372
}
73+
if (
74+
innerThenable === null ||
75+
typeof innerThenable !== "object" ||
76+
typeof innerThenable.then !== "function"
77+
) {
78+
message +=
79+
"Expected to obtain an inner promise that would reject with a" +
80+
expectedErrorConstructor.name +
81+
" but result was not a thenable";
82+
throw new Test262Error(message);
83+
}
8484

8585
try {
8686
resolve(innerThenable.then(

0 commit comments

Comments
 (0)