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


Java CompositeException类代码示例

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


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

示例1: emitError

import rx.exceptions.CompositeException; //导入依赖的package包/类
void emitError(Throwable t) {
  set(STATE_TERMINATED);

  if (!isUnsubscribed()) {
    try {
      subscriber.onError(t);
    } catch (OnCompletedFailedException
        | OnErrorFailedException
        | OnErrorNotImplementedException e) {
      RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:CallArbiter.java

示例2: onNext

import rx.exceptions.CompositeException; //导入依赖的package包/类
@Override public void onNext(Response<R> response) {
  if (response.isSuccessful()) {
    subscriber.onNext(response.body());
  } else {
    subscriberTerminated = true;
    Throwable t = new HttpException(response);
    try {
      subscriber.onError(t);
    } catch (OnCompletedFailedException
        | OnErrorFailedException
        | OnErrorNotImplementedException e) {
      RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:BodyOnSubscribe.java

示例3: onError

import rx.exceptions.CompositeException; //导入依赖的package包/类
@Override public void onError(Throwable throwable) {
  try {
    subscriber.onNext(Result.<R>error(throwable));
  } catch (Throwable t) {
    try {
      subscriber.onError(t);
    } catch (OnCompletedFailedException
        | OnErrorFailedException
        | OnErrorNotImplementedException e) {
      RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
    return;
  }
  subscriber.onCompleted();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:ResultOnSubscribe.java

示例4: onNext

import rx.exceptions.CompositeException; //导入依赖的package包/类
@Override
public void onNext(Response<R> response) {
    if (response.isSuccessful()) {
        subscriber.onNext(response.body());
    } else {
        subscriberTerminated = true;
        Throwable t = new HttpException(response);
        try {
            subscriber.onError(t);
        } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) {
            RxJavaHooks.getOnError().call(e);
        } catch (Throwable inner) {
            Exceptions.throwIfFatal(inner);
            RxJavaHooks.getOnError().call(new CompositeException(t, inner));
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:BodyOnSubscribe.java

示例5: onError

import rx.exceptions.CompositeException; //导入依赖的package包/类
@Override
public void onError(Throwable throwable) {
    try {
        subscriber.onNext(Result.<R>error(throwable));
    } catch (Throwable t) {
        try {
            subscriber.onError(t);
        } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) {
            RxJavaHooks.getOnError().call(e);
        } catch (Throwable inner) {
            Exceptions.throwIfFatal(inner);
            RxJavaHooks.getOnError().call(new CompositeException(t, inner));
        }
        return;
    }
    subscriber.onCompleted();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:ResultOnSubscribe.java

示例6: assertNoTerminalEvent

import rx.exceptions.CompositeException; //导入依赖的package包/类
public void assertNoTerminalEvent() {
    List<Throwable> err = this.testObserver.getOnErrorEvents();
    int s = this.testObserver.getOnCompletedEvents().size();
    if (err.size() <= 0 && s <= 0) {
        return;
    }
    if (err.isEmpty()) {
        throw new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none");
    } else if (err.size() == 1) {
        ae = new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none");
        ae.initCause((Throwable) err.get(0));
        throw ae;
    } else {
        ae = new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none");
        ae.initCause(new CompositeException(err));
        throw ae;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:TestSubscriber.java

示例7: parseException

import rx.exceptions.CompositeException; //导入依赖的package包/类
public Observable<String> parseException(Throwable throwable) {
    if (!BuildConfig.DEBUG && !(throwable instanceof BadResponseException))
        return Observable.just(getString(R.string.errors_happen));

    String message = throwable.getMessage();

    if(throwable.getCause() != null) message += System.getProperty("line.separator") + throwable.getCause().getMessage();

    if (throwable instanceof CompositeException) {
        message += System.getProperty("line.separator");
        CompositeException compositeException = (CompositeException) throwable;

        for (Throwable exception : compositeException.getExceptions()) {
            String exceptionName = exception.getClass().getSimpleName();
            String exceptionMessage = exception.getMessage() != null ? exception.getMessage() : "";
            message += exceptionName + " -> " + exceptionMessage + System.getProperty("line.separator");
        }
    }

    return Observable.just(message);
}
 
开发者ID:FuckBoilerplate,项目名称:base_app_android,代码行数:22,代码来源:BaseFragment.java

示例8: ensureIfSendToSqsFailsThatS3ObjectIsDeleted

import rx.exceptions.CompositeException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void ensureIfSendToSqsFailsThatS3ObjectIsDeleted() {
	AmazonSQSClient sqs = Mockito.mock(AmazonSQSClient.class);
	AmazonS3Client s3 = Mockito.mock(AmazonS3Client.class);
	Mockito.when(sqs.sendMessage(Mockito.anyString(), Mockito.anyString())).thenThrow(RuntimeException.class);
	try {
		Sqs.sendToQueueUsingS3(sqs, "queueUrl", s3, "bucket", new byte[] { 1, 2 });
	} catch (RuntimeException e) {
		assertTrue(e instanceof CompositeException);
		InOrder inorder = Mockito.inOrder(sqs, s3);
		inorder.verify(s3, Mockito.times(1)).putObject(Mockito.anyString(), Mockito.anyString(), Mockito.any(),
				Mockito.any());
		inorder.verify(sqs, Mockito.times(1)).sendMessage(Mockito.anyString(), Mockito.anyString());
		inorder.verify(s3, Mockito.times(1)).deleteObject(Mockito.anyString(), Mockito.anyString());
		inorder.verifyNoMoreInteractions();
	}
}
 
开发者ID:davidmoten,项目名称:rxjava-aws,代码行数:19,代码来源:SqsTest.java

示例9: onErrorFailureSafe

import rx.exceptions.CompositeException; //导入依赖的package包/类
@Test
public void onErrorFailureSafe() {
    try {
        new SafeSubscriber<String>(OBSERVER_ONERROR_FAIL()).onError(new SafeObserverTestException("error!"));
        fail("expects exception to be thrown");
    } catch (Exception e) {
        e.printStackTrace();
        assertTrue(e instanceof RuntimeException);
        assertEquals("Error occurred when trying to propagate error to Observer.onError", e.getMessage());

        Throwable e2 = e.getCause();
        assertTrue(e2 instanceof CompositeException);
        List<Throwable> innerExceptions = ((CompositeException) e2).getExceptions();
        assertEquals(2, innerExceptions.size());

        Throwable e3 = innerExceptions.get(0);
        assertTrue(e3 instanceof SafeObserverTestException);
        assertEquals("error!", e3.getMessage());

        Throwable e4 = innerExceptions.get(1);
        assertTrue(e4 instanceof SafeObserverTestException);
        assertEquals("onErrorFail", e4.getMessage());
    }
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:25,代码来源:SafeObserverTest.java

示例10: onNextOnErrorFailureSafe

import rx.exceptions.CompositeException; //导入依赖的package包/类
@Test
public void onNextOnErrorFailureSafe() {
    try {
        new SafeSubscriber<String>(OBSERVER_ONNEXT_ONERROR_FAIL()).onNext("one");
        fail("expects exception to be thrown");
    } catch (Exception e) {
        e.printStackTrace();
        assertTrue(e instanceof RuntimeException);
        assertEquals("Error occurred when trying to propagate error to Observer.onError", e.getMessage());

        Throwable e2 = e.getCause();
        assertTrue(e2 instanceof CompositeException);
        List<Throwable> innerExceptions = ((CompositeException) e2).getExceptions();
        assertEquals(2, innerExceptions.size());

        Throwable e3 = innerExceptions.get(0);
        assertTrue(e3 instanceof SafeObserverTestException);
        assertEquals("onNextFail", e3.getMessage());

        Throwable e4 = innerExceptions.get(1);
        assertTrue(e4 instanceof SafeObserverTestException);
        assertEquals("onErrorFail", e4.getMessage());
    }
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:25,代码来源:SafeObserverTest.java

示例11: logErr

import rx.exceptions.CompositeException; //导入依赖的package包/类
private static void logErr(String prefix, Throwable e, int sent, int total) {
    if (LOGGER.isWarnEnabled()) {
        final Throwable cause = e.getCause() != null ? e.getCause() : e;
        String msg = String.format("%s exception %s:%s Sent %d/%d",
                prefix,
                cause.getClass().getSimpleName(), cause.getMessage(),
                sent, total);
        LOGGER.warn(msg);
        if (cause instanceof CompositeException) {
            CompositeException ce = (CompositeException) cause;
            for (Throwable t : ce.getExceptions()) {
                LOGGER.warn(" Exception {}: {}", t.getClass().getSimpleName(), t.getMessage());
            }
        }
    }
}
 
开发者ID:dmuino,项目名称:atlas-oss-plugin,代码行数:17,代码来源:RxHttp.java

示例12: drainAndComplete

import rx.exceptions.CompositeException; //导入依赖的package包/类
private void drainAndComplete() {
    drainQueuesIfNeeded(); // TODO need to confirm whether this is needed or not
    if (delayErrors) {
        Queue<Throwable> es = null;
        synchronized (this) {
            es = exceptions;
        }
        if (es != null) {
            if (es.isEmpty()) {
                actual.onCompleted();
            } else if (es.size() == 1) {
                actual.onError(es.poll());
            } else {
                actual.onError(new CompositeException(es));
            }
        } else {
            actual.onCompleted();
        }
    } else {
        actual.onCompleted();
    }
}
 
开发者ID:ReactiveX,项目名称:RxJavaParallel,代码行数:23,代码来源:OperatorParallelMerge.java

示例13: emitError

import rx.exceptions.CompositeException; //导入依赖的package包/类
void emitError(Throwable t) {
  set(STATE_TERMINATED);

  if (!isUnsubscribed()) {
    try {
      subscriber.onError(t);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:CallArbiter.java

示例14: onNext

import rx.exceptions.CompositeException; //导入依赖的package包/类
@Override public void onNext(Response<R> response) {
  if (response.isSuccessful()) {
    subscriber.onNext(response.body());
  } else {
    subscriberTerminated = true;
    Throwable t = new HttpException(response);
    try {
      subscriber.onError(t);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:BodyOnSubscribe.java

示例15: onError

import rx.exceptions.CompositeException; //导入依赖的package包/类
@Override public void onError(Throwable throwable) {
  try {
    subscriber.onNext(Result.<R>error(throwable));
  } catch (Throwable t) {
    try {
      subscriber.onError(t);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
    return;
  }
  subscriber.onCompleted();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:ResultOnSubscribe.java


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