You are here

public function HttpError::__construct in Little helpers 7.2

Same name and namespace in other branches
  1. 7 src/Rest/HttpError.php \Drupal\little_helpers\Rest\HttpError::__construct()

Construct the error class from a result object.

File

src/Rest/HttpError.php, line 15

Class

HttpError
An exception class that signifies a non 200 HTTP response.

Namespace

Drupal\little_helpers\Rest

Code

public function __construct($result) {
  $msg = "HTTP {$result->code}: {$result->error}";
  parent::__construct($msg, $result->code);
  $this->result = $result;
}