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
F15490845: D21542.id51277.diff
Fri, Apr 11, 9:04 PM
F15489453: D21542.id51278.diff
Fri, Apr 11, 9:16 AM
F15487331: D21542.id.diff
Thu, Apr 10, 1:17 PM
F15482401: D21542.diff
Wed, Apr 9, 5:13 AM
F15450966: D21542.id51278.diff
Fri, Mar 28, 7:20 PM
F15450370: D21542.diff
Fri, Mar 28, 3:19 PM
F15449078: D21542.id51277.diff
Fri, Mar 28, 8:25 AM
F15431768: D21542.id51277.diff
Mar 24 2025, 2:23 PM
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
Branch
lint4
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 25091
Build 34623: Run Core Tests
Build 34622: arc lint + arc unit