4 ms·
I recently started throwing bare string instead of Error objects, just because of all the Error: prefixes that are prepended to the error message when you throw
by prmph 5y ago
I recently started throwing bare string instead of Error objects, just because of all the Error: prefixes that are prepended to the error message when you throw an Error. It just clutters up the stack trace.
More generally I wish there was an Error constructor that automatically records and the function, arguments, and other semantically meaningful information when called. File and line numbers do not make for a pleasant experience when inspecting a stack trace.