Here is what I want to do:

var setting = process.env.SETTING || throw new Error("please set the SETTING environmental variable");
                                     ^^^^^

But the interpreter complains about "Syntax Error: Unexpected token throw".

Is there any way to throw an exception in the same line that we compare whether a value is falsey or not?

Edit
Report