use of io.vertx.up.exception.WebException in project vertx-zero by silentbalanceyh.
the class Fluctuate method thenOtherwise.
static <T, R> Future<R> thenOtherwise(final Future<Boolean> conditionFuture, final Supplier<Future<T>> supplierTrue, final Function<T, R> trueFun, final Class<? extends WebException> clazz, final Object... args) {
final Future<R> future = Future.future();
conditionFuture.setHandler(handler -> {
if (handler.succeeded() && handler.result()) {
// Success & Boolean
final Future<T> trueFuture = supplierTrue.get();
trueFuture.setHandler(trueRes -> future.complete(trueFun.apply(trueRes.result())));
} else {
// Failed & Boolean = false;
if (null == clazz) {
future.complete();
} else {
// Error existing
final WebException error = Instance.instance(clazz, args);
future.fail(error);
}
}
});
return future;
}
use of io.vertx.up.exception.WebException in project vertx-zero by silentbalanceyh.
the class ErrorTc method buildError.
@Test
public void buildError() {
final WebException error = new _500InternalServerException(this.getClass(), "Error Internal");
System.out.println(error);
Assert.assertNotNull(error);
}
Aggregations