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
*
* "apihelp-{$this->getModulePath()}-description".
*
* @deprecated since 1.25
- * @return Message|string|array
+ * @return Message|string|array|false
*/
protected function getDescription() {
return false;