/** * Utility - return true if the given exception is retry-able * * @param exception exception to check * @return true/false */ public static bool IsRetryException(Exception exception) { if (exception.GetType() == typeof(KeeperException)) { KeeperException keeperException = (KeeperException)exception; return(ShouldRetry((int)keeperException.GetCode())); } return(false); }
public static ZkException Create(KeeperException e) { switch (e.GetCode()) { case KeeperException.Code.NONODE: return new ZkNoNodeException(e.Message, e); case KeeperException.Code.BADVERSION: return new ZkBadVersionException(e.Message, e); case KeeperException.Code.NODEEXISTS: return new ZkNodeExistsException(e.Message, e); default: return new ZkException(e.Message, e); } }