Parameter validation is based on parameter definitions like those in the Action API, using the new ParamValidator library. Handlers should use the provided Handler methods to access parameters rather than fetching them directly from the RequestInterface. Body validation allows the handler to have the (non-form-data) body of a request parsed and validated. The only validator included in this patch ignores the body entirely; future patches may implement validation for JSON bodies based on JSON schemas, or the like. Bug: T223239 Change-Id: I3c37ea2b432840514b6bff90007c8403989225d5
26 lines
558 B
PHP
26 lines
558 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Rest;
|
|
|
|
/**
|
|
* This is the base exception class for non-fatal exceptions thrown from REST
|
|
* handlers. The exception is not logged, it is merely converted to an
|
|
* error response.
|
|
*/
|
|
class HttpException extends \Exception {
|
|
|
|
/** @var array|null */
|
|
private $errorData = null;
|
|
|
|
public function __construct( $message, $code = 500, $errorData = null ) {
|
|
parent::__construct( $message, $code );
|
|
$this->errorData = $errorData;
|
|
}
|
|
|
|
/**
|
|
* @return array|null
|
|
*/
|
|
public function getErrorData() {
|
|
return $this->errorData;
|
|
}
|
|
}
|