public function checkGitkitError($response) {
    if (isset($response['error'])) {
      $error = $response['error'];
      if (!isset($error['code'])) {
        throw new Gitkit_ServerException('null error code from Gitkit server');
      } else {
        $code = $error['code'];
        if (strpos($code, '4') === 0) {
          throw new Gitkit_ClientException($error['message']);
        } else {
          throw new Gitkit_ServerException($error['message']);
        }
      }
    } else {
      return $response;
    }
  }