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
F19813682: D21542.diff
Wed, Mar 4, 10:32 AM
F19802800: D21542.diff
Sun, Mar 1, 6:58 PM
F19658441: D21542.diff
Feb 6 2026, 11:08 PM
F19256373: D21542.id51277.diff
Dec 22 2025, 1:19 PM
F18829740: D21542.id51277.diff
Oct 25 2025, 12:41 AM
F18809389: D21542.diff
Oct 19 2025, 1:35 PM
F18782995: D21542.diff
Oct 13 2025, 3:16 AM
F18671341: D21542.id51278.diff
Sep 25 2025, 3:33 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
Branch
lint4
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 25091
Build 34623: Run Core Tests
Build 34622: arc lint + arc unit