/**
* Checks the response for Http errors.
*
* @param Response $response
* @throws \LeagueWrap\Response\Http400
* @throws \LeagueWrap\Response\Http401
* @throws \LeagueWrap\Response\Http402
* @throws \LeagueWrap\Response\Http403
* @throws \LeagueWrap\Response\Http404
* @throws \LeagueWrap\Response\Http405
* @throws \LeagueWrap\Response\Http406
* @throws \LeagueWrap\Response\Http407
* @throws \LeagueWrap\Response\Http408
* @throws \LeagueWrap\Response\Http429
* @throws \LeagueWrap\Response\Http500
* @throws \LeagueWrap\Response\Http501
* @throws \LeagueWrap\Response\Http502
* @throws \LeagueWrap\Response\Http503
* @throws \LeagueWrap\Response\Http504
* @throws \LeagueWrap\Response\Http505
*/
protected function checkResponseErrors(Response $response)
{
$code = $response->getCode();
if (intval($code / 100) != 2) {
// we have an error!
$message = "Http Error.";
if (isset($this->responseErrors[$code])) {
$message = trim($this->responseErrors[$code]);
}
$class = 'LeagueWrap\\Response\\Http' . $code;
throw new $class($message, $code);
}
}