Page MenuHomePhabricator

Add a lint check for catching "Exception" without catching "Throwable"
ClosedPublic

Authored by epriestley on Feb 3 2021, 10:42 PM.
Tags
None
Referenced Files
F18575441: D21542.id.diff
Wed, Sep 10, 1:15 PM
F18571552: D21542.id51278.diff
Wed, Sep 10, 5:08 AM
F18571550: D21542.id51277.diff
Wed, Sep 10, 5:08 AM
F18562819: D21542.diff
Tue, Sep 9, 4:58 AM
F18162333: D21542.diff
Aug 15 2025, 4:26 AM
F18101343: D21542.id.diff
Aug 9 2025, 12:27 PM
F18098666: D21542.id51277.diff
Aug 8 2025, 10:10 PM
F18097162: D21542.id51278.diff
Aug 8 2025, 11:28 AM
Subscribers
None

Details

Summary

Ref T13588. For consistency of behavior between versions on either side of PHP7, any "catch (Exception)" block should generally have a "catch (Throwable)" block in the same catch list.

Raise a lint warning when "Exception" is caught without also catching "Throwable", since this is almost certainly not desired.

Test Plan

Added tests.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable