It is not usually recommended to reuse errors since the stack trace is attached whenever the error is instantiated.
However in some cases the overhead of doing that may affect performance, especially if the error is an exception that is known to occur frequently and is handled.
Only in these cases it may be advantagous to reuse the created Error
. In all other cases getting a full stacktrace created at the time the exception occurs is to be preferred as it gives much better information needed to debug the problem.
➝ node errors.js