当前位置: 首页>>代码示例>>Java>>正文


Java CompositeException类代码示例

本文整理汇总了Java中io.reactivex.exceptions.CompositeException的典型用法代码示例。如果您正苦于以下问题:Java CompositeException类的具体用法?Java CompositeException怎么用?Java CompositeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CompositeException类属于io.reactivex.exceptions包,在下文中一共展示了CompositeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onComplete

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@Override
public void onComplete(@NonNull Task<Void> task) {
    if (isDisposed()) return;
    if (!task.isSuccessful()) {
        Exception exception = task.getException();
        if (terminated) {
            RxJavaPlugins.onError(exception);
        } else {
            try {
                terminated = true;
                observer.onError(exception);
            } catch (Throwable t) {
                Exceptions.throwIfFatal(t);
                RxJavaPlugins.onError(new CompositeException(task.getException(), t));
            }
        }
    }
}
 
开发者ID:niqo01,项目名称:RxTask,代码行数:19,代码来源:ObservableTaskCallback.java

示例2: onResponse

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@Override public void onResponse(Call<T> call, Response<T> response) {
  if (call.isCanceled()) return;

  try {
    observer.onNext(response);

    if (!call.isCanceled()) {
      terminated = true;
      observer.onComplete();
    }
  } catch (Throwable t) {
    if (terminated) {
      RxJavaPlugins.onError(t);
    } else if (!call.isCanceled()) {
      try {
        observer.onError(t);
      } catch (Throwable inner) {
        Exceptions.throwIfFatal(inner);
        RxJavaPlugins.onError(new CompositeException(t, inner));
      }
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:CallEnqueueObservable.java

示例3: onResponse

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@Override
public void onResponse(Call<T> call, Response<T> response) {
    if (call.isCanceled()) return;

    try {
        observer.onNext(
                new ProgressBean<>(mTotal, mTotal, response)
        );

        if (!call.isCanceled()) {
            terminated = true;
            observer.onComplete();
        }
    } catch (Throwable t) {
        if (terminated) {
            RxJavaPlugins.onError(t);
        } else if (!call.isCanceled()) {
            try {
                observer.onError(t);
            } catch (Throwable inner) {
                Exceptions.throwIfFatal(inner);
                RxJavaPlugins.onError(new CompositeException(t, inner));
            }
        }
    }
}
 
开发者ID:imfms,项目名称:retrofit-rxjava-request-with-progress,代码行数:27,代码来源:CallEnqueueWithProgressObservable.java

示例4: onError

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@Override
public void onError(Throwable throwable) {
    try {
        Result<R> error = Result.error(throwable);
        observer.onNext(
                new ProgressBean<>(-1, -1, error)
        );
    } catch (Throwable t) {
        try {
            observer.onError(t);
        } catch (Throwable inner) {
            Exceptions.throwIfFatal(inner);
            RxJavaPlugins.onError(new CompositeException(t, inner));
        }
        return;
    }
    observer.onComplete();
}
 
开发者ID:imfms,项目名称:retrofit-rxjava-request-with-progress,代码行数:19,代码来源:ResultWithProgressObservable.java

示例5: onNext

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@Override
public void onNext(Response<R> response) {
    if (response.isSuccessful()) {
        if (response.body() != null) {
            observer.onNext(response.body());
        } else {
            observer.onComplete();
        }
    } else {
        terminated = true;
        Throwable t = new HttpException(response);
        try {
            observer.onError(t);
        } catch (Throwable inner) {
            Exceptions.throwIfFatal(inner);
            RxJavaPlugins.onError(new CompositeException(t, inner));
        }
    }
}
 
开发者ID:octaware,项目名称:super-volley,代码行数:20,代码来源:BodyObservable.java

示例6: onComplete

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@Override
public void onComplete(@NonNull Task<T> task) {
    if (isDisposed()) return;
    if (task.isSuccessful()) {
        T result = task.getResult();
        if (result == null) {
            observer.onComplete();
        } else {
            observer.onSuccess(result);
        }
    } else {
        try {
            observer.onError(task.getException());
        } catch (Throwable t) {
            Exceptions.throwIfFatal(t);
            RxJavaPlugins.onError(new CompositeException(task.getException(), t));
        }
    }
}
 
开发者ID:niqo01,项目名称:RxTask,代码行数:20,代码来源:MaybeTaskCallback.java

示例7: appendLast

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
/**
 * Try appending this FunctionTaggingException as the very last cause of
 * the given throwable.
 * @param ex the Throwable to append to
 * @return ex the original Throwable
 */
public Throwable appendLast(Throwable ex) {
    Throwable r = ex;
    Set<Throwable> memory = new HashSet<Throwable>();
    while (ex.getCause() != null) {
        if (memory.add(ex)) {
            ex = ex.getCause();
        } else {
            // didn't work
            RxJavaPlugins.onError(new CompositeException(r, this));
            return r;
        }
    }

    try {
        ex.initCause(this);
    } catch (Throwable exc) {
        // didn't work, oh well
        RxJavaPlugins.onError(new CompositeException(r, this));
    }
    return r;
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:28,代码来源:FunctionTagging.java

示例8: onErrorCrash

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@Test
public void onErrorCrash() {
    List<Throwable> errors = TestHelper.trackPluginErrors();
    try {
        SingleConsumers.subscribeAutoDispose(processor, composite, this, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable t) throws Exception {
                throw new IOException(t);
            }
        });

        processor.onError(new IllegalArgumentException());

        assertTrue(events.toString(), events.isEmpty());

        TestHelper.assertError(errors, 0, CompositeException.class);
        List<Throwable> inners = TestHelper.compositeList(errors.get(0));
        TestHelper.assertError(inners, 0, IllegalArgumentException.class);
        TestHelper.assertError(inners, 1, IOException.class);
    } finally {
        RxJavaPlugins.reset();
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:24,代码来源:SingleConsumersTest.java

示例9: onErrorCrash

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@Test
public void onErrorCrash() {
    List<Throwable> errors = TestHelper.trackPluginErrors();
    try {
        MaybeConsumers.subscribeAutoDispose(processor, composite, this, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable t) throws Exception {
                throw new IOException(t);
            }
        }, this);

        processor.onError(new IllegalArgumentException());

        assertTrue(events.toString(), events.isEmpty());

        TestHelper.assertError(errors, 0, CompositeException.class);
        List<Throwable> inners = TestHelper.compositeList(errors.get(0));
        TestHelper.assertError(inners, 0, IllegalArgumentException.class);
        TestHelper.assertError(inners, 1, IOException.class);
    } finally {
        RxJavaPlugins.reset();
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:24,代码来源:MaybeConsumersTest.java

示例10: onErrorCrash

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@Test
public void onErrorCrash() {
    List<Throwable> errors = TestHelper.trackPluginErrors();
    try {
        CompletableConsumers.subscribeAutoDispose(processor, composite, this, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable t) throws Exception {
                throw new IOException(t);
            }
        });

        processor.onError(new IllegalArgumentException());

        assertTrue(events.toString(), events.isEmpty());

        TestHelper.assertError(errors, 0, CompositeException.class);
        List<Throwable> inners = TestHelper.compositeList(errors.get(0));
        TestHelper.assertError(inners, 0, IllegalArgumentException.class);
        TestHelper.assertError(inners, 1, IOException.class);
    } finally {
        RxJavaPlugins.reset();
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:24,代码来源:CompletableConsumersTest.java

示例11: bothErrorDelayed

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void bothErrorDelayed() {
    Flowables.orderedMerge(Functions.<Integer>naturalComparator(),
            true,
            Flowable.<Integer>error(new IOException("first")),
            Flowable.<Integer>error(new IOException("second"))
    )
    .test()
    .assertFailure(CompositeException.class)
    .assertOf(new Consumer<TestSubscriber<Integer>>() {
        @Override
        public void accept(TestSubscriber<Integer> ts) throws Exception {
            List<Throwable> list = TestHelper.compositeList(ts.errors().get(0));

            TestHelper.assertError(list, 0, IOException.class, "first");
            TestHelper.assertError(list, 1, IOException.class, "second");
        }
    });
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:21,代码来源:FlowableOrderedMergeTest.java

示例12: bothErrorDelayedBackpressured

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void bothErrorDelayedBackpressured() {
    Flowables.orderedMerge(Functions.<Integer>naturalComparator(),
            true,
            Flowable.<Integer>error(new IOException("first")),
            Flowable.<Integer>error(new IOException("second"))
    )
    .test(0L)
    .assertFailure(CompositeException.class)
    .assertOf(new Consumer<TestSubscriber<Integer>>() {
        @Override
        public void accept(TestSubscriber<Integer> ts) throws Exception {
            List<Throwable> list = TestHelper.compositeList(ts.errors().get(0));

            TestHelper.assertError(list, 0, IOException.class, "first");
            TestHelper.assertError(list, 1, IOException.class, "second");
        }
    });
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:21,代码来源:FlowableOrderedMergeTest.java

示例13: nonEmptyBothErrorDelayed

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void nonEmptyBothErrorDelayed() {
    Flowables.orderedMerge(Functions.<Integer>naturalComparator(),
            true,
            Flowable.just(1).concatWith(Flowable.<Integer>error(new IOException("first"))),
            Flowable.just(2).concatWith(Flowable.<Integer>error(new IOException("second")))
    )
    .test()
    .assertFailure(CompositeException.class, 1, 2)
    .assertOf(new Consumer<TestSubscriber<Integer>>() {
        @Override
        public void accept(TestSubscriber<Integer> ts) throws Exception {
            List<Throwable> list = TestHelper.compositeList(ts.errors().get(0));

            TestHelper.assertError(list, 0, IOException.class, "first");
            TestHelper.assertError(list, 1, IOException.class, "second");
        }
    });
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:21,代码来源:FlowableOrderedMergeTest.java

示例14: nonEmptyBothErrorDelayed2

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void nonEmptyBothErrorDelayed2() {
    Flowables.orderedMerge(Functions.<Integer>naturalComparator(),
            true,
            Flowable.just(1).concatWith(Flowable.<Integer>error(new IOException("first"))),
            Flowable.just(2).concatWith(Flowable.<Integer>error(new IOException("second")))
    )
    .rebatchRequests(1)
    .test()
    .assertFailure(CompositeException.class, 1, 2)
    .assertOf(new Consumer<TestSubscriber<Integer>>() {
        @Override
        public void accept(TestSubscriber<Integer> ts) throws Exception {
            List<Throwable> list = TestHelper.compositeList(ts.errors().get(0));

            TestHelper.assertError(list, 0, IOException.class, "first");
            TestHelper.assertError(list, 1, IOException.class, "second");
        }
    });
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:22,代码来源:FlowableOrderedMergeTest.java

示例15: usingDisposerThrows2

import io.reactivex.exceptions.CompositeException; //导入依赖的package包/类
@Test
public void usingDisposerThrows2() {
    Nono.using(Functions.justCallable(0),
            Functions.justFunction(ioError),
            new Consumer<Integer>() {
                @Override
                public void accept(Integer t) throws Exception {
                    throw new IllegalArgumentException();
                }
            }
    )
    .test()
    .assertFailure(CompositeException.class)
    .assertOf(new Consumer<TestSubscriber<Void>>() {
        @SuppressWarnings("unchecked")
        @Override
        public void accept(TestSubscriber<Void> ts) throws Exception {
            TestHelper.assertCompositeExceptions(ts, IOException.class, IllegalArgumentException.class);
        }
    });
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:22,代码来源:NonoTest.java


注:本文中的io.reactivex.exceptions.CompositeException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。