Skip to content

Commit 100a0c2

Browse files
committed
10-try-catch
1 parent c7c7bd4 commit 100a0c2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

promises.tex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,13 @@ \section{Promises}\label{s:promises-promises}
326326
327327
\noindent
328328
then the error message won't appear
329-
because the call to \texttt{fetch} doesn't raise an exception right away.
329+
because the function \texttt{fetch} is asynchronous.
330+
331+
There are two passes of execution in this block:
332+
The first is the \texttt{try...catch} event loop,
333+
and the second is \texttt{fetch}.
334+
JavaScript rips the asynchronous code right out of the execution context!
335+
There's no error, because \texttt{fetch} never got the chance to run.
330336
331337
Going back to the \texttt{fs-extra.stat} example above,
332338
what if we want to process multiple files,

0 commit comments

Comments
 (0)