| 1 |
// Copyright 2014 Cubane Canada, Inc. All rights reserved. |
| 2 |
// See LICENSE for details. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
Promise catches exceptions thrown from executor and turns |
| 7 |
them into reject |
| 8 |
es6id: S25.4.3.1_A4.1_T1 |
| 9 |
author: Sam Mikes |
| 10 |
description: new Promise(function () { throw }) should reject |
| 11 |
flags: [async] |
| 12 |
---*/ |
| 13 |
|
| 14 |
var errorObject = {}, |
| 15 |
p = new Promise(function() { |
| 16 |
throw errorObject; |
| 17 |
}); |
| 18 |
|
| 19 |
p.then(function() { |
| 20 |
$ERROR("Unexpected fulfill -- promise should reject."); |
| 21 |
}, function(err) { |
| 22 |
if (err !== errorObject) { |
| 23 |
$ERROR("Expected promise rejection reason to be thrown errorObject, actually " + err); |
| 24 |
} |
| 25 |
}).then($DONE, $DONE); |