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
*