mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-27 22:50:22 -04:00
Deal with promise rejection also.
This commit is contained in:
parent
57057bfffc
commit
9881ee76b9
1 changed files with 10 additions and 1 deletions
|
@ -94,12 +94,21 @@ var execute = function (sequencer, thread) {
|
|||
);
|
||||
if (isPromise) {
|
||||
primitiveReportedValue.then(function(resolvedValue) {
|
||||
// Promise resolved: the primitive reported a value.
|
||||
if (DEBUG_BLOCK_CALLS) {
|
||||
console.log('reporting value: ', resolvedValue);
|
||||
}
|
||||
thread.pushReportedValue(resolvedValue);
|
||||
sequencer.proceedThread(thread);
|
||||
});
|
||||
}, function(rejectionReason) {
|
||||
// Promise rejected: the primitive had some error.
|
||||
// Log it and proceed.
|
||||
if (DEBUG_BLOCK_CALLS) {
|
||||
console.warn('primitive rejected promise: ', rejectionReason);
|
||||
}
|
||||
sequencer.proceedThread(thread);
|
||||
}
|
||||
);
|
||||
} else if (thread.status === Thread.STATUS_RUNNING) {
|
||||
if (DEBUG_BLOCK_CALLS) {
|
||||
console.log('reporting value: ', primitiveReportedValue);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue