Esempio n. 1
0
 public static extern C4Error c4error_make(C4ErrorDomain domain, int code, FLSlice message);
Esempio n. 2
0
 public static C4Error c4error_make(C4ErrorDomain domain, int code, string message)
 {
     using (var message_ = new C4String(message)) {
         return(NativeRaw.c4error_make(domain, code, message_.AsFLSlice()));
     }
 }
        private void RunReplication(ReplicatorConfiguration config, int expectedErrCode, C4ErrorDomain expectedErrDomain)
        {
            Misc.SafeSwap(ref _repl, new Replicator(config));
            _waitAssert = new WaitAssert();
            var token = _repl.AddChangeListener((sender, args) =>
            {
                _waitAssert.RunConditionalAssert(() =>
                {
                    VerifyChange(args, expectedErrCode, expectedErrDomain);
                    if (config.Continuous && args.Status.Activity == ReplicatorActivityLevel.Idle &&
                        args.Status.Progress.Completed == args.Status.Progress.Total)
                    {
                        ((Replicator)sender).Stop();
                    }

                    return(args.Status.Activity == ReplicatorActivityLevel.Stopped);
                });
            });

            _repl.Start();
            try {
                _waitAssert.WaitForResult(TimeSpan.FromSeconds(10));
            } catch {
                _repl.Stop();
                throw;
            } finally {
                _repl.RemoveChangeListener(token);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Allows the operation to succeed even if an error with the
 /// given code and domain occurs
 /// </summary>
 /// <returns>The current object for further fluent operations</returns>
 /// <param name="code">The code of the error to allow.</param>
 /// <param name="domain">The domain of the error to allow.</param>
 public NativeHandler AllowError(int code, C4ErrorDomain domain)
 {
     return(AllowError(new C4Error(domain, code)));
 }
Esempio n. 5
0
 public C4Error(C4ErrorDomain domain, int code)
 {
     this.code     = code;
     this.domain   = domain;
     internal_info = 0;
 }
        private void VerifyChange(ReplicatorStatusChangedEventArgs change, int errorCode, C4ErrorDomain domain)
        {
            var s = change.Status;

            WriteLine($"---Status: {s.Activity} ({s.Progress.Completed} / {s.Progress.Total}), lastError = {s.Error}");
            if (s.Activity == ReplicatorActivityLevel.Stopped)
            {
                if (errorCode != 0)
                {
                    s.Error.Should().BeAssignableTo <LiteCoreException>();
                    var error = s.Error.As <LiteCoreException>().Error;
                    error.code.Should().Be(errorCode);
                    if ((int)domain != 0)
                    {
                        error.domain.As <C4ErrorDomain>().Should().Be(domain);
                    }
                }
                else
                {
                    s.Error.Should().BeNull("because otherwise an unexpected error occurred");
                }
            }
        }
Esempio n. 7
0
        private void AssertMessage(C4ErrorDomain domain, int code, string expected)
        {
            var msg = Native.c4error_getMessage(new C4Error(domain, code));

            msg.Should().Be(expected, "because the error message should match the code");
        }
Esempio n. 8
0
 public CBForestException(int code, C4ErrorDomain domain)
     : this(new C4Error { code = code, domain = domain })
 {
 }
 public C4Error c4error_make(C4ErrorDomain domain, int code, C4Slice message) => NativeRaw.c4error_make(domain, code, message);
Esempio n. 10
0
 public CBForestException(int code, C4ErrorDomain domain)
     : this(new C4Error {
     code = code, domain = domain
 })
 {
 }
 public C4Error c4error_make(C4ErrorDomain domain, int code, string message) => Native.c4error_make(domain, code, message);
Esempio n. 12
0
 /// <summary>
 /// Allows the operation to succeed even if an error with the
 /// given code and domain occurs
 /// </summary>
 /// <returns>The current object for further fluent operations</returns>
 /// <param name="code">The code of the error to allow.</param>
 /// <param name="domain">The domain of the error to allow.</param>
 public RetryHandler AllowError(int code, C4ErrorDomain domain)
 {
     return(AllowError(new C4Error {
         code = code, domain = domain
     }));
 }
 public static C4Error c4error_make(C4ErrorDomain domain, int code, string message) => Impl.c4error_make(domain, code, message);
 public C4Error(C4ErrorDomain domain, int code)
 {
     _code   = code;
     _domain = domain;
 }
Esempio n. 15
0
 /// <summary>
 /// Allows the operation to succeed even if an error with the
 /// given code and domain occurs
 /// </summary>
 /// <returns>The current object for further fluent operations</returns>
 /// <param name="code">The code of the error to allow.</param>
 /// <param name="domain">The domain of the error to allow.</param>
 public RetryHandler AllowError(int code, C4ErrorDomain domain)
 {
     return AllowError(new C4Error { code = code, domain = domain });
 }