An exception representing an error status from the native CBForest module
Inheritance: System.ApplicationException
Exemplo n.º 1
0
        private unsafe C4Slice Execute(C4TryLogicDelegate4 block, int attemptCount)
        {
            if (attemptCount > _maxAttempts)
            {
                ThrowOrHandle();
            }

            var err    = default(C4Error);
            var retVal = block(&err);

            if (retVal.buf != null)
            {
                Exception = null;
                return(retVal);
            }

            Exception = new CBForestException(err);
            if (err.domain == C4ErrorDomain.ForestDB && err.code == (int)ForestDBStatus.HandleBusy)
            {
                Thread.Sleep(RETRY_TIME);
                return(Execute(block, attemptCount + 1));
            }

            ThrowOrHandle();
            return(retVal);
        }
Exemplo n.º 2
0
        private unsafe int Execute(C4TryLogicDelegate3 block, int attemptCount)
        {
            if (attemptCount > _maxAttempts) {
                ThrowOrHandle();
            }

            var err = default(C4Error);
            var retVal = block(&err);
            if (retVal >= 0) {
                Exception = null;
                return retVal;
            }

            Exception = new CBForestException(err);
            if (err.domain == C4ErrorDomain.ForestDB && err.code == (int)ForestDBStatus.HandleBusy) {
                Thread.Sleep(RETRY_TIME);
                return Execute(block, attemptCount + 1);
            }

            ThrowOrHandle();
            return retVal;
        }