| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 981a1ef commit d27ec13
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -255,12 +255,13 @@ function REPLServer(prompt, | |||
| 255 | 255 | } | |
| 256 | 256 | } catch (e) { | |
| 257 | 257 | err = e; | |
| 258 | - if (err.message === 'Script execution interrupted.') { | ||
| 258 | + | ||
| 259 | + if (err && err.message === 'Script execution interrupted.') { | ||
| 259 | 260 | // The stack trace for this case is not very useful anyway. | |
| 260 | 261 | Object.defineProperty(err, 'stack', { value: '' }); | |
| 261 | 262 | } | |
| 262 | 263 | ||
| 263 | - if (err && process.domain) { | ||
| 264 | + if (process.domain) { | ||
| 264 | 265 | debug('not recoverable, send to domain'); | |
| 265 | 266 | process.domain.emit('error', err); | |
| 266 | 267 | process.domain.exit(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + require('../common'); | ||
| 3 | + | ||
| 4 | + // This test ensures that the repl does not | ||
| 5 | + // crash or emit error when throwing `null|undefined` | ||
| 6 | + // ie `throw null` or `throw undefined` | ||
| 7 | + | ||
| 8 | + const assert = require('assert'); | ||
| 9 | + const repl = require('repl'); | ||
| 10 | + | ||
| 11 | + const r = repl.start(); | ||
| 12 | + | ||
| 13 | + assert.doesNotThrow(() => { | ||
| 14 | + r.write('throw null\n'); | ||
| 15 | + r.write('throw undefined\n'); | ||
| 16 | + }, TypeError, 'repl crashes/throw error on `throw null|undefined`'); | ||
| 17 | + | ||
| 18 | + r.write('.exit\n'); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments