Merge "Cleanup some incorrect return annotations"
[lhc/web/wiklou.git] / includes / api / ApiBase.php
index a40593f..6fad630 100644 (file)
@@ -1723,6 +1723,20 @@ abstract class ApiBase extends ContextSource {
                throw ApiUsageException::newWithMessage( $this, $msg, $code, $data, $httpCode );
        }
 
+       /**
+        * Abort execution with an error derived from an exception
+        *
+        * @since 1.29
+        * @param Exception|Throwable $exception See ApiErrorFormatter::getMessageFromException()
+        * @param array $options See ApiErrorFormatter::getMessageFromException()
+        * @throws ApiUsageException always
+        */
+       public function dieWithException( $exception, array $options = [] ) {
+               $this->dieWithError(
+                       $this->getErrorFormatter()->getMessageFromException( $exception, $options )
+               );
+       }
+
        /**
         * Adds a warning to the output, else dies
         *
@@ -2229,7 +2243,7 @@ abstract class ApiBase extends ContextSource {
         * "apihelp-{$this->getModulePath()}-description".
         *
         * @deprecated since 1.25
-        * @return Message|string|array
+        * @return Message|string|array|false
         */
        protected function getDescription() {
                return false;