Skip to content

Dont-Reassign-Caught-Exceptions

Sourcery rule id: dont-reassign-caught-exceptions

Description

Don't reassign the bound exception ${exc}

Match

try { whatever(); } catch (e) { e = new Error('something'); }

Explanation

Reassigning exceptions may lead to unexpected behaviour, and the variable should be treated as if it were constant.