Page MenuHomePhabricator

Enable phan rules to warn if a checked exception is not caught or documented
Open, Needs TriagePublic

Description

If function X throws a checked exception (documenting it in its doc comment with @throws), then anything calling X should either catch the exception, or document it with @throws in its own doc comment.

Phan can check this using the warn_about_undocumented_exceptions_thrown_by_invoked_functions option, so this should be enabled in our config.

Event Timeline

Change 928523 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/tools/phan@master] Warn if a checked exception is not caught or re-documented

https://gerrit.wikimedia.org/r/928523

Phan can check this using the warn_about_undocumented_exceptions_thrown_by_invoked_functions option, so this should be enabled in our config.

This currently crashes on mediawiki/core (although it works on other repos), reported as https://github.com/phan/phan/issues/5490