Skip to content
This repository has been archived by the owner on Aug 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #174 from codehag/fix-118-add-error-prose
Browse files Browse the repository at this point in the history
Add a section describing what happens when an error is encountered in…
  • Loading branch information
codehag authored May 13, 2021
2 parents 3f566ac + def0210 commit 3b732b9
Showing 1 changed file with 111 additions and 0 deletions.
111 changes: 111 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,117 @@ <h1>Example Cyclic Module Record Graphs</h1>
</tbody>
</table>
</emu-table>

<p><ins>
Alternatively, consider a failure case where _C_ fails execution and returns an error before _B_ has finished executing. When that happens, AsyncModuleExecutionRejected is called and _C_.[[AsyncEvaluating]] is set to *false*. We then set the evaluation error of the module to the error returned by executing _C_. We then propagate this error to all of the AsyncParentModules by performing AsyncModuleExeutionRejected on each of them. The fields of the updated modules are as given in <emu-xref href="#table-module-graph-cycle-async-fields-7"></emu-xref>.
</ins></p>

<emu-table id="table-module-graph-cycle-async-fields-7" caption="Module fields after module _C_ finishes with an error">
<table>
<thead>
<tr>
<th>Module</th>
<th>[[DFSIndex]]</th>
<th>[[DFSAncestorIndex]]</th>
<th>[[AsyncEvaluating]]</th>
<th>[[AsyncParentModules]]</th>
<th>[[PendingAsyncDependencies]]</th>
<th>[[EvaluationError]]</th>
</tr>
</thead>
<tbody>
<tr>
<th>_A_</th>
<td>0</td>
<td>0</td>
<td>*true*</td>
<td>&laquo; &raquo;</td>
<td>1 (_B_)</td>
<td>~empty~</td>
</tr>
<tr>
<th>_C_</th>
<td>2</td>
<td>1</td>
<td>*false*</td>
<td>&laquo; _A_ &raquo;</td>
<td>_C_'s evaluation error</td>
</tr>
</tbody>
</table>
</emu-table>

<p><ins>
_A_ will be rejected with the same error as _C_ since _C_ will call AsyncModuleExecutionRejected on _A_ with _C_'s error. _A_.[[AsyncEvaluating]] is set to *false*. At this point the Promise in _A_.[[TopLevelCapability]] (which was returned from _A_.Evaluate()) is rejected. The fields of the updated module are as given in <emu-xref href="#table-module-graph-cycle-async-fields-8"></emu-xref>.
</ins></p>

<emu-table id="table-module-graph-cycle-async-fields-8" caption="Module fields after module _A_ is rejected">
<table>
<thead>
<tr>
<th>Module</th>
<th>[[DFSIndex]]</th>
<th>[[DFSAncestorIndex]]</th>
<th>[[AsyncEvaluating]]</th>
<th>[[AsyncParentModules]]</th>
<th>[[PendingAsyncDependencies]]</th>
<th>[[EvaluationError]]</th>
</tr>
</thead>
<tbody>
<tr>
<th>_A_</th>
<td>0</td>
<td>0</td>
<td>*false*</td>
<td>&laquo; &raquo;</td>
<td>0</td>
<td>_C_'s Evaluation Error</td>
</tr>
</tbody>
</table>
</emu-table>

<p><ins>
Then, _B_ finishes executing without an error. When that happens, AsyncModuleExecutionFulfilled is called again and _B_.[[AsyncEvaluating]] is set to *false*. GatherAsyncParentCompletions is called on _B_. However, _A_.[[CycleRoot]] is _A_ which has an evaluation error, so it will not be added to the returned _sortedExecList_ and AsyncModuleExecutionFulfilled will return without further processing. Any future importer of _B_ will resolve the rejection of _B_.[[CycleRoot]].[[EvaluationError]] from the evaluation error from _C_ that was set on the cycle root _A_. The fields of the updated modules are as given in <emu-xref href="#table-module-graph-cycle-async-fields-9"></emu-xref>.
</ins></p>

<emu-table id="table-module-graph-cycle-async-fields-5" caption="Module fields after module _B_ finishes executing in an erroring graph">
<table>
<thead>
<tr>
<th>Module</th>
<th>[[DFSIndex]]</th>
<th>[[DFSAncestorIndex]]</th>
<th>[[AsyncEvaluating]]</th>
<th>[[AsyncParentModules]]</th>
<th>[[PendingAsyncDependencies]]</th>
<th>[[EvaluationError]]</th>
</tr>
</thead>
<tbody>
<tr>
<th>_A_</th>
<td>0</td>
<td>0</td>
<td>*false*</td>
<td>&laquo; &raquo;</td>
<td>0</td>
<td>_C_'s Evaluation Error</td>
</tr>
<tr>
<th>_B_</th>
<td>1</td>
<td>0</td>
<td>*false*</td>
<td>&laquo; _A_ &raquo;</td>
<td>0</td>
<td>~empty~</td>
</tr>
</tbody>
</table>
</emu-table>

</emu-clause>
</emu-clause>
<emu-clause id="sec-source-text-module-records">
Expand Down

0 comments on commit 3b732b9

Please sign in to comment.