only-throw-error
Configuration
rslint.config.ts
Rule Details
Disallow throwing non-Error values as exceptions. It is considered good practice to only throw Error objects, because they automatically capture a stack trace which can be used to debug the error. Throwing non-Error values such as strings, numbers, or undefined does not provide this benefit and makes debugging harder.
Examples of incorrect code for this rule:
Examples of correct code for this rule: