| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 26ec20a commit d340dca
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -163,30 +163,21 @@ This use of the [`domain`][] module in the REPL has these side effects: | |||
| 163 | 163 | ||
| 164 | 164 | * Uncaught exceptions only emit the [`'uncaughtException'`][] event in the | |
| 165 | 165 | standalone REPL. Adding a listener for this event in a REPL within | |
| 166 | - another Node.js program throws [`ERR_INVALID_REPL_INPUT`][]. | ||
| 167 | - * Trying to use [`process.setUncaughtExceptionCaptureCallback()`][] throws | ||
| 168 | - an [`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`][] error. | ||
| 169 | - | ||
| 170 | - As standalone program: | ||
| 171 | - | ||
| 172 | - ```js | ||
| 173 | - process.on('uncaughtException', () => console.log('Uncaught')); | ||
| 166 | + another Node.js program results in [`ERR_INVALID_REPL_INPUT`][]. | ||
| 174 | 167 | ||
| 175 | - throw new Error('foobar'); | ||
| 176 | - // Uncaught | ||
| 177 | - ``` | ||
| 168 | + ```js | ||
| 169 | + const r = repl.start(); | ||
| 178 | 170 | ||
| 179 | - When used in another application: | ||
| 171 | + r.write('process.on("uncaughtException", () => console.log("Foobar"));\n'); | ||
| 172 | + // Output stream includes: | ||
| 173 | + // TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` | ||
| 174 | + // cannot be used in the REPL | ||
| 180 | 175 | ||
| 181 | - ```js | ||
| 182 | - process.on('uncaughtException', () => console.log('Uncaught')); | ||
| 183 | - // TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` | ||
| 184 | - // cannot be used in the REPL | ||
| 176 | + r.close(); | ||
| 177 | + ``` | ||
| 185 | 178 | ||
| 186 | - throw new Error('foobar'); | ||
| 187 | - // Thrown: | ||
| 188 | - // Error: foobar | ||
| 189 | - ``` | ||
| 179 | + * Trying to use [`process.setUncaughtExceptionCaptureCallback()`][] throws | ||
| 180 | + an [`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`][] error. | ||
| 190 | 181 | ||
| 191 | 182 | #### Assignment of the `_` (underscore) variable | |
| 192 | 183 | <!-- YAML | |
| Back | FazBrowse Home | New Git URL |
0 commit comments