Skip to content

exceptionAssignments

Reports reassigning exception parameters in catch clauses.

✅ This rule is included in the ts logical and logicalStrict presets.

Reassigning an exception parameter in a catch clause can make debugging more difficult by obscuring the original error. The exception parameter contains important information about what went wrong, and reassigning it makes it harder to understand the root cause of an error.

AEt53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0processDa53(<);d ivclassNa="meec-li">53<} sp ansty="le--0:#C792EA;--1:#8844">AEcat53 (error)< {d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">53erroA5<3 sp ansty="le--0:#7FDBCA;--1:#096E">72n5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0Err5<3(sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4DProcessing fail1<1"sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEthr53 erro5<3}d ivclassNa="meco"><}d>AEt53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0validateInp53(<);d ivclassNa="meec-li">53<} sp ansty="le--0:#C792EA;--1:#8844">AEcat53 (exception)< {d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">53exceptioA5<3 sp ansty="le--0:#FF6A83;--1:#A248">48nu5<3;d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">53consoAB0l53(exception<);d ivclassNa="meec-li">5<3}d ivclassNa="meco"><}d>
44A3F<53 {divclass="Nameec-">de61B0process3F5<3() ;divclass="Nameec-">3F<53} spans="tyle--0:#C792EA;--1:#88">44AEc3F53 (errode44AEco61B0wrappedE44A6E7<2new spans="tyle--0:#C792EA;--1:#88">4<4AE spans="tyle--0:#82AAFF;--1:#3B">61B0E31<111" spans="tyle--0:#ECC48D;--1:#98">4E4DProcessing fa1<111" spans="tyle--0:#D6DEEB;--1:#40">3F<53) ;divclass="Nameec-">de44AEt3F53 wrappedEr3<}di vdivclass="Nameexpressive-">44A3F<53 {divclass="Nameec-">de61B0validateI3F5<3() ;divclass="Nameec-">3F<53} spans="tyle--0:#C792EA;--1:#88">44AEc3F53 (exceptio3F<53 spans="tyle--0:#D6DEEB;--1:#40">3F53con4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B<0log spans="tyle--0:#D6DEEB;--1:#40">3F53(excep4<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72mes3F<53) ;divclass="Nameec-">3<);>

This rule is not configurable.

If you’re working in an existing codebase where reassigning exception parameters is an established pattern and refactoring would be too costly, you might choose to disable this rule. However, this is generally not recommended as it can make code harder to debug and maintain.