Pattern: Missing message in Error
constructor
Issue: -
Creating Error
objects without a message parameter reduces code readability and makes debugging more difficult. Always include a descriptive error message when throwing errors.
Example of incorrect code:
throw Error();
throw new TypeError();
Example of correct code:
throw new Error("Unexpected token");
throw new TypeError("Number expected");