public static boolean contains404(Throwable t) { return returnValueOnCodeOrNull(t, true, equalTo(404)) != null; } }
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (returnValueOnCodeOrNull(t, false, equalTo(400)) != null) return false; throw propagate(t); } }
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (returnValueOnCodeOrNull(t, false, equalTo(400)) != null) return false; throw propagate(t); } }
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (returnValueOnCodeOrNull(t, false, equalTo(400)) != null) return false; throw propagate(t); } }
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (returnValueOnCodeOrNull(t, false, equalTo(400)) != null) return false; throw propagate(t); } }
public Boolean createOrPropagate(Throwable t) throws Exception { if (containsResourceNotFoundException(checkNotNull(t, "throwable")) || returnValueOnCodeOrNull(t, true, equalTo(422)) != null) return false; throw propagate(t); } }
public Optional<Object> createOrPropagate(Throwable t) throws Exception { Boolean returnVal = returnValueOnCodeOrNull(checkNotNull(t, "throwable"), true, in(asList(403, 404, 500))); if (returnVal != null) return Optional.absent(); throw propagate(t); } }
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (contains404(checkNotNull(t, "throwable"))) return true; if (returnValueOnCodeOrNull(t, false, equalTo(409)) != null) return false; throw propagate(t); } }
public Optional<Object> createOrPropagate(Throwable t) throws Exception { Boolean returnVal = returnValueOnCodeOrNull(checkNotNull(t, "throwable"), true, in(asList(403, 404, 500))); if (returnVal != null) return Optional.absent(); throw propagate(t); } }
public Optional<Object> createOrPropagate(Throwable t) throws Exception { Boolean returnVal = returnValueOnCodeOrNull(checkNotNull(t, "throwable"), true, in(asList(403, 404, 500))); if (returnVal != null) return Optional.absent(); throw propagate(t); } }
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (contains404(checkNotNull(t, "throwable"))) return true; if (returnValueOnCodeOrNull(t, false, equalTo(409)) != null) return false; throw propagate(t); } }
public Optional<Object> createOrPropagate(Throwable t) throws Exception { Boolean returnVal = returnValueOnCodeOrNull(checkNotNull(t, "throwable"), true, in(asList(403, 404, 500))); if (returnVal != null) return Optional.absent(); throw propagate(t); } }
public Void createOrPropagate(Throwable t) throws Exception { AuthorizationException ex = returnValueOnCodeOrNull(t, new AuthorizationException(t.getMessage(), t), new Predicate<Integer>() { @Override public boolean apply(Integer input) { return input >= 400 && input < 500; } }); throw ex != null ? ex : propagate(t); } }
@Override public Object createOrPropagate(Throwable t) throws Exception { Boolean returnVal = returnValueOnCodeOrNull(checkNotNull(t, "throwable"), false, in(asList(400, 404))); if (returnVal != null) return null; throw propagate(t); } }
@Override public Object createOrPropagate(Throwable t) throws Exception { Boolean returnVal = returnValueOnCodeOrNull(checkNotNull(t, "throwable"), false, in(asList(400, 404))); if (returnVal != null) return null; throw propagate(t); } }
public Void createOrPropagate(Throwable t) throws Exception { AuthorizationException ex = returnValueOnCodeOrNull(t, new AuthorizationException(t.getMessage(), t), new Predicate<Integer>() { @Override public boolean apply(Integer input) { return input >= 400 && input < 500; } }); throw ex != null ? ex : propagate(t); } }
public Void createOrPropagate(Throwable t) throws Exception { AuthorizationException ex = returnValueOnCodeOrNull(t, new AuthorizationException(t.getMessage(), t), new Predicate<Integer>() { @Override public boolean apply(Integer input) { return input >= 400 && input < 500; } }); throw ex != null ? ex : propagate(t); } }
@Override public Boolean createOrPropagate(Throwable t) throws Exception { if (getFirstThrowableOfType(checkNotNull(t, "throwable"), IllegalStateException.class) != null) return false; if (getFirstThrowableOfType(t, ContainerNotFoundException.class) != null) return true; if (returnValueOnCodeOrNull(t, true, equalTo(404)) != null) return true; throw propagate(t); } }
public void testNullResponse() { Exception from = new HttpResponseException("message", null, null); assertEquals(returnValueOnCodeOrNull(from, true, equalTo(404)), null); } }
public void test404() { Exception from = new HttpResponseException("message", null, HttpResponse.builder().statusCode(404).message("not found").build()); assertEquals(returnValueOnCodeOrNull(from, true, equalTo(404)), Boolean.TRUE); }