* Add warnings and errors from a StatusValue object to the result
* @param string|null $modulePath
* @param StatusValue $status
- * @param string[] $types 'warning' and/or 'error'
+ * @param string[]|string $types 'warning' and/or 'error'
*/
public function addMessagesFromStatus(
$modulePath, StatusValue $status, $types = [ 'warning', 'error' ]
$msg = Message::newFromSpecifier( $exception );
$params = [];
} else {
- // Extract code and data from the exception, if applicable
- if ( $exception instanceof UsageException ) {
- $data = $exception->getMessageArray();
- if ( !$options['code'] ) {
- $options['code'] = $data['code'];
- }
- unset( $data['code'], $data['info'] );
- $options['data'] = array_merge( $data, $options['data'] );
- }
-
if ( isset( $options['wrap'] ) ) {
$msg = $options['wrap'];
} else {
public function formatException( $exception, array $options = [] ) {
return $this->formatMessage(
$this->getMessageFromException( $exception, $options ),
- isset( $options['format'] ) ? $options['format'] : null
+ $options['format'] ?? null
);
}