Exemple #1
0
        private void StrictFailureHandler(RocksDbFailureEvent failure)
        {
            Contract.Requires(failure != null);

            var ex          = failure.Failure.Content;
            var isUserError = true;

            if (ex is RocksDbSharpException || ex is System.Runtime.InteropServices.SEHException)
            {
                // The SEHException class handles SEH (structured exception handling) errors that are thrown from
                // unmanaged code, but that have not been mapped to another .NET Framework exception. The SEHException
                // class also corresponds to the HRESULT E_FAIL (0x80004005).
                isUserError = false;
            }

            failure.Invalidate = true;
            failure.Rethrow    = isUserError;
        }
Exemple #2
0
        private Failure <Exception> HandleException(Exception exception, out bool rethrow)
        {
            Contract.Requires(exception != null);

            var failure = new RocksDbFailureEvent(exception);

            // This defaults the behavior to the safest one. This is done for backwards-compatibility with existing
            // code.
            StrictFailureHandler(failure);
            m_failureHandler?.Invoke(failure);

            rethrow = failure.Rethrow;
            if (failure.Invalidate)
            {
                InvalidateStore(failure.Failure);
            }

            return(failure.Failure);
        }