Skip to content

Throw-New-Errors

Sourcery rule id: throw-new-errors

Description

New errors should not be created without being thrown.

Match

new Error("whatever");

Explanation

Although it is valid to construct an error without throwing it, this behaviour is likely unintended: errors must be explicitly thrown.