protected function guessError($err, $uri, $method) {

    $regex = '/HTTP\/1\.[01]? ([0-9]+) ([ a-zA-Z]+)/';
    $matches = array();
    preg_match($regex, $err, $matches);

    if (count($matches) < 3) {
      throw new \HPCloud\Exception($err);
    }

    Response::failure($matches[1], $matches[0], $uri, $method);
  }
protected function guessError($err, $uri, $method) {

    $regex = '/HTTP\/1\.[01]? ([0-9]+) ([ a-zA-Z]+)/';
    $matches = array();
    preg_match($regex, $err, $matches);

    if (count($matches) < 3) {
      throw new \HPCloud\Exception($err);
    }

    Response::failure($matches[1], $matches[0], $uri, $method);
  }
protected function guessError ( $ err , $ uri , $ method ) { $ regex = '/HTTP\/1\.[01]? ([0-9]+) ([ a-zA-Z]+)/' ; $ matches = array ( ) ; preg_match ( $ regex , $ err , $ matches ) ; if ( count ( $ matches ) < 3 ) { throw new \ HPCloud \ Exception ( $ err ) ; } Response :: failure ( $ matches [ 1 ] , $ matches [ 0 ] , $ uri , $ method ) ; }
Given an error, this tries to guess the cause and throw an exception.

Stream wrappers do not deal with error conditions gracefully. (For starters,
during an error one cannot access the HTTP headers). The only useful piece
of data given is the contents of the last error buffer.

This uses the contents of that buffer to attempt to learn what happened
during the request. It then throws an exception that seems appropriate for the
given context.
Given an error this tries to guess the cause and throw an exception .