In a recent code review, a more senior colleague asked that I throw an error in an exported function so I wasn't just writing a console.log that mi...
For further actions, you may consider blocking this person and/or reporting abuse
Please always use
throw new Error("message...").For historical reasons, you can throw strings (or anything, really) but it's not considered good form. For one, the
Errorclass has astacktraceproperty that gets populated when you throw it. For another, in terms of semantics, a string simply isn't an error - it's just a string; the value itself won't have much meaning to the code that catches it.