mirror of https://github.com/lukechilds/node.git
Browse Source
Only throw the Error object itself or an object using the Error object as base objects for user-defined exceptions. PR-URL: https://github.com/nodejs/node/pull/11168 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>v7.x
Rich Trott
8 years ago
committed by
Italo A. Casas
12 changed files with 13 additions and 6 deletions
@ -1,4 +1,4 @@ |
|||
*test*message*throw_custom_error.js:5 |
|||
*test*message*throw_custom_error.js:6 |
|||
throw ({ name: 'MyCustomError', message: 'This is a custom message' }); |
|||
^ |
|||
MyCustomError: This is a custom message |
|||
|
@ -1,5 +1,5 @@ |
|||
before |
|||
*test*message*throw_in_line_with_tabs.js:9 |
|||
*test*message*throw_in_line_with_tabs.js:10 |
|||
throw ({ foo: 'bar' }); |
|||
^ |
|||
[object Object] |
|||
|
@ -1,4 +1,4 @@ |
|||
*test*message*throw_non_error.js:5 |
|||
*test*message*throw_non_error.js:6 |
|||
throw ({ foo: 'bar' }); |
|||
^ |
|||
[object Object] |
|||
|
@ -1,4 +1,5 @@ |
|||
'use strict'; |
|||
require('../common'); |
|||
|
|||
// eslint-disable-next-line no-throw-literal
|
|||
throw null; |
|||
|
@ -1,5 +1,5 @@ |
|||
|
|||
*test*message*throw_null.js:4 |
|||
*test*message*throw_null.js:5 |
|||
throw null; |
|||
^ |
|||
null |
|||
|
@ -1,4 +1,5 @@ |
|||
'use strict'; |
|||
require('../common'); |
|||
|
|||
// eslint-disable-next-line no-throw-literal
|
|||
throw undefined; |
|||
|
@ -1,5 +1,5 @@ |
|||
|
|||
*test*message*throw_undefined.js:4 |
|||
*test*message*throw_undefined.js:5 |
|||
throw undefined; |
|||
^ |
|||
undefined |
|||
|
Loading…
Reference in new issue