private static function applicationErrorToException($error,
                                                      $destination_url) {
    switch ($error->getApplicationError()) {
      case ErrorCode::REDIRECT_URL_TOO_LONG:
        return new UsersException('URL too long: ' . $destination_url);
      case ErrorCode::NOT_ALLOWED:
        return new UsersException('Action not allowed.');
      default:
        return new UsersException(
            'Error code: ' . $error->getApplicationError());
    }
  }
private static function applicationErrorToException($error,
                                                      $destination_url) {
    switch ($error->getApplicationError()) {
      case ErrorCode::REDIRECT_URL_TOO_LONG:
        return new UsersException('URL too long: ' . $destination_url);
      case ErrorCode::NOT_ALLOWED:
        return new UsersException('Action not allowed.');
      default:
        return new UsersException(
            'Error code: ' . $error->getApplicationError());
    }
  }
private static function applicationErrorToException ( $ error , $ destination_url ) { switch ( $ error -> getApplicationError ( ) ) { case ErrorCode :: REDIRECT_URL_TOO_LONG : return new UsersException ( 'URL too long: ' . $ destination_url ) ; case ErrorCode :: NOT_ALLOWED : return new UsersException ( 'Action not allowed.' ) ; default : return new UsersException ( 'Error code: ' . $ error -> getApplicationError ( ) ) ; } }
Convert a UserService RPC error to an exception.

@param mixed $error The application error object.
@param string $destination_url A URL that was used for the RPC call.

@return mixed The correct exception object for the supplied error.

@access private.
Convert a UserService RPC error to an exception .