public static function failure($code, $err = 'Unknown', $uri = '', $method = '', $extra = '') {

    // syslog(LOG_WARNING, print_r($extra, TRUE));
    switch ($code) {

      case '403':
        throw new \HPCloud\Transport\ForbiddenException($err);
      case '401':
        throw new \HPCloud\Transport\UnauthorizedException($err);
      case '404':
        throw new \HPCloud\Transport\FileNotFoundException($err . " ($uri)");
      case '405':
        throw new \HPCloud\Transport\MethodNotAllowedException($err . " ($method $uri)");
      case '409':
        throw new \HPCloud\Transport\ConflictException($err);
      case '412':
        throw new \HPCloud\Transport\LengthRequiredException($err);
      case '422':
        throw new \HPCloud\Transport\UnprocessableEntityException($err);
      case '423':
        throw new \HPCloud\Transport\LockedException($err);
      case '500':
        throw new \HPCloud\Transport\ServerException($err);
      default:
        throw new \HPCloud\Exception($err);

    }

  }
public static function failure($code, $err = 'Unknown', $uri = '', $method = '', $extra = '') {

    // syslog(LOG_WARNING, print_r($extra, TRUE));
    switch ($code) {

      case '403':
        throw new \HPCloud\Transport\ForbiddenException($err);
      case '401':
        throw new \HPCloud\Transport\UnauthorizedException($err);
      case '404':
        throw new \HPCloud\Transport\FileNotFoundException($err . " ($uri)");
      case '405':
        throw new \HPCloud\Transport\MethodNotAllowedException($err . " ($method $uri)");
      case '409':
        throw new \HPCloud\Transport\ConflictException($err);
      case '412':
        throw new \HPCloud\Transport\LengthRequiredException($err);
      case '422':
        throw new \HPCloud\Transport\UnprocessableEntityException($err);
      case '423':
        throw new \HPCloud\Transport\LockedException($err);
      case '500':
        throw new \HPCloud\Transport\ServerException($err);
      default:
        throw new \HPCloud\Exception($err);

    }

  }
public static function failure ( $ code , $ err = 'Unknown' , $ uri = '' , $ method = '' , $ extra = '' ) { // syslog(LOG_WARNING, print_r($extra, TRUE)); switch ( $ code ) { case '403' : throw new \ HPCloud \ Transport \ ForbiddenException ( $ err ) ; case '401' : throw new \ HPCloud \ Transport \ UnauthorizedException ( $ err ) ; case '404' : throw new \ HPCloud \ Transport \ FileNotFoundException ( $ err . " ($uri)" ) ; case '405' : throw new \ HPCloud \ Transport \ MethodNotAllowedException ( $ err . " ($method $uri)" ) ; case '409' : throw new \ HPCloud \ Transport \ ConflictException ( $ err ) ; case '412' : throw new \ HPCloud \ Transport \ LengthRequiredException ( $ err ) ; case '422' : throw new \ HPCloud \ Transport \ UnprocessableEntityException ( $ err ) ; case '423' : throw new \ HPCloud \ Transport \ LockedException ( $ err ) ; case '500' : throw new \ HPCloud \ Transport \ ServerException ( $ err ) ; default : throw new \ HPCloud \ Exception ( $ err ) ; } }
Handle error response.

When a response is a failure, it should pass through this function,
which generates the appropriate exception and then throws it.

@param int $code
The HTTP status code, e.g. 404, 500.
@param string $err
The error string, as bubbled up.
@param string $uri
The URI.
@param string $method
The HTTP method, e.g. 'HEAD', 'GET', 'DELETE'.
@param string $extra
An extra string of debugging information. (NOT USED)
@throws HPCloud::Exception
A wide variety of HPCloud::Transport exceptions.
Handle error response .