Mark DBError as runtime exception
authorGergő Tisza <tgr.huwiki@gmail.com>
Tue, 2 Jan 2018 22:07:28 +0000 (14:07 -0800)
committerGergő Tisza <gtisza@wikimedia.org>
Wed, 3 Jan 2018 02:26:17 +0000 (02:26 +0000)
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

includes/libs/rdbms/exception/DBError.php

index 2f7499b..5023800 100644 (file)
 
 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;