You are here

HttpError.php in Little helpers 7

Same filename and directory in other branches
  1. 7.2 src/Rest/HttpError.php

File

src/Rest/HttpError.php
View source
<?php

namespace Drupal\little_helpers\Rest;


/**
 * An exception class that signifies a non 200 HTTP response.
 */
class HttpError extends \Exception {
  public $result;

  /**
   * Construct the error class from a result object.
   */
  public function __construct($result) {
    $msg = "HTTP {$result->code}: {$result->error}";
    parent::__construct($msg, $result->code);
    $this->result = $result;
  }

}

Classes

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