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);

    }

  }