From: Gergő Tisza Date: Tue, 2 Jan 2018 22:07:28 +0000 (-0800) Subject: Mark DBError as runtime exception X-Git-Tag: 1.31.0-rc.0~1008^2 X-Git-Url: http://git.cyclocoop.org/wiki/Target_page?a=commitdiff_plain;h=cd222cc601cdd4a95eb37389afbb503167664b90;p=lhc%2Fweb%2Fwiklou.git Mark DBError as runtime exception Some tools (e.g. PHPStorm) can trace exceptions through the call tree and show warnings when a call can throw an exception which is neither handled nor acknowledged via @throws annotation. This is quite useful but currently too noisy to use due to all methods involving some kind of DB interaction potentially throwing a DBError. To avoid false warnings, make DBError inherit from RuntimeException to signal it to such tools that it is not meant to be handled. Change-Id: I847d258791b128547e10672c5e06a9ce18458371 --- diff --git a/includes/libs/rdbms/exception/DBError.php b/includes/libs/rdbms/exception/DBError.php index 2f7499bc64..50238003a2 100644 --- a/includes/libs/rdbms/exception/DBError.php +++ b/includes/libs/rdbms/exception/DBError.php @@ -21,13 +21,13 @@ namespace Wikimedia\Rdbms; -use Exception; +use RuntimeException; /** * Database error base class * @ingroup Database */ -class DBError extends Exception { +class DBError extends RuntimeException { /** @var IDatabase|null */ public $db;