3 ms·
Don't throw strings. Use the Error object.
by shtylman 13y ago
Don't throw strings. Use the Error object.
- jimmaswell 13y agoI don't see why it really matters most of the time, especially in one-off javascript scripts.
- strager 13y agoError objects have stack traces in modern engines, which is very helpful for debugging. Strings do not.
- jimmaswell 13y agoThat seems like poor design on the engines' part.
- shtylman 13y agoBecause someone will come along and copy and paste your broken code and put it into something else and now more people have to deal with it. Just take the steps to make it not suck from day 1 :)