IdkGoodName Vilius (2019-02-24T14:43:38.000Z)
I am proposing a syntatic sugar, which would check if throw value is not
null, or not undefined. It would make less typing and no if, for throw
statements. Syntax is simple. Here's an example of it:
```js
throw? e
```
This is basically equivalent to:
```js
if(e !== null && e !== undefined) throw e
```
What's the purpose of that? Well, in some node js modules, error as null,
or undefined is sometimes passed.
Example of that is:
```js
const {exec} = require('child_process')
exec('...', {cwd: '...'}, (err, stdout, stderr) => {
    if(err !== null) throw err
})
```

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190224/486d11fd/attachment.html>
viliuskubilius416 at gmail.com (2019-02-24T14:48:54.222Z)
I am proposing a syntatic sugar, which would check if throw value is not
null, or not undefined. It would make less typing and no if, for throw
statements. Syntax is simple. Here's an example of it:
```js
throw? e
```
This is basically equivalent to:
```js
if(e !== null && e !== undefined) throw e
```
What's the purpose of that? Well, in some node js modules, error as null,
or undefined is sometimes passed.
Example of that is:
```js
const {exec} = require('child_process')
exec('...', {cwd: '...'}, (err, stdout, stderr) => {
    if(err !== null) throw err
})
```