@Override public String handleException(Exception exception) { return exception.getMessage(); } }
@Override public String handleException(Exception exception) { return exception.getMessage(); } }
@Override public String handleException(Exception exception) { return exception.getMessage(); } }
@Override public final void afterPropertiesSet() throws IllegalArgumentException, BeanInitializationException { if (this.jmsTemplate == null) { throw new IllegalArgumentException("'connectionFactory' or 'jmsTemplate' is required"); } try { initGateway(); } catch (Exception ex) { throw new BeanInitializationException("Initialization of JMS gateway failed: " + ex.getMessage(), ex); } }
@Override @ExceptionHandler(Exception.class) @ResponseBody public String handleException(Exception exception) { return exception.getMessage(); } }
@ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public String errorHandler(Exception e) { return e.getMessage(); }
@ExceptionHandler public ModelAndView handle(Exception ex) throws IOException { return new ModelAndView("errorView", "detail", ex.getMessage()); } }
@ExceptionHandler(Exception.class) @ResponseBody public String handleException(Exception exception) { return exception.getMessage(); } }
private Object readResolved(Type resolvedType, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { Reader reader = getReader(inputMessage); try { return readInternal(resolvedType, reader); } catch (Exception ex) { throw new HttpMessageNotReadableException("Could not read JSON: " + ex.getMessage(), ex, inputMessage); } }
public void testCheckedThrowableSync(CacheableService<?> service) throws Exception { String arg = UUID.randomUUID().toString(); try { service.throwCheckedSync(arg); fail("Excepted exception"); } catch (Exception ex) { ex.printStackTrace(); assertEquals("Wrong exception type", IOException.class, ex.getClass()); assertEquals(arg, ex.getMessage()); } }
public void testCheckedThrowable(CacheableService<?> service) throws Exception { String arg = UUID.randomUUID().toString(); try { service.throwChecked(arg); fail("Excepted exception"); } catch (Exception ex) { assertEquals("Wrong exception type", IOException.class, ex.getClass()); assertEquals(arg, ex.getMessage()); } }
@Test public void onCompleteFailure() { AtomicReference<Throwable> onError = new AtomicReference<Throwable>(); try { OBSERVER_ONCOMPLETED_FAIL(onError).onComplete(); fail("expects exception to be thrown"); } catch (Exception e) { assertNull(onError.get()); assertTrue(e instanceof SafeObserverTestException); assertEquals("onCompleteFail", e.getMessage()); } }
@Test public void onNextFailure() { AtomicReference<Throwable> onError = new AtomicReference<Throwable>(); try { OBSERVER_ONNEXT_FAIL(onError).onNext("one"); fail("expects exception to be thrown"); } catch (Exception e) { assertNull(onError.get()); assertTrue(e instanceof SafeSubscriberTestException); assertEquals("onNextFail", e.getMessage()); } }
@Test public void onCompleteFailure() { AtomicReference<Throwable> onError = new AtomicReference<Throwable>(); try { OBSERVER_ONCOMPLETED_FAIL(onError).onComplete(); fail("expects exception to be thrown"); } catch (Exception e) { assertNull(onError.get()); assertTrue(e instanceof SafeSubscriberTestException); assertEquals("onCompleteFail", e.getMessage()); } }
@Test public void onNextFailure() { AtomicReference<Throwable> onError = new AtomicReference<Throwable>(); try { OBSERVER_ONNEXT_FAIL(onError).onNext("one"); fail("expects exception to be thrown"); } catch (Exception e) { assertNull(onError.get()); assertTrue(e instanceof SafeObserverTestException); assertEquals("onNextFail", e.getMessage()); } }
@Test public void onNextOnErrorFailure() { try { OBSERVER_ONNEXT_ONERROR_FAIL().onNext("one"); fail("expects exception to be thrown"); } catch (Exception e) { e.printStackTrace(); assertTrue(e instanceof SafeObserverTestException); assertEquals("onNextFail", e.getMessage()); } }
@Test public void onNextOnErrorFailure() { try { OBSERVER_ONNEXT_ONERROR_FAIL().onNext("one"); fail("expects exception to be thrown"); } catch (Exception e) { e.printStackTrace(); assertTrue(e instanceof SafeSubscriberTestException); assertEquals("onNextFail", e.getMessage()); } }
private void checkNumber(String expression, Object value, Class<?> type) { try { SpelExpressionParser parser = new SpelExpressionParser(); SpelExpression expr = parser.parseRaw(expression); Object exprVal = expr.getValue(); assertEquals(value, exprVal); assertEquals(type, exprVal.getClass()); } catch (Exception ex) { fail(ex.getMessage()); } }
@Test public void onErrorFailure() { try { subscriberOnErrorFail().onError(new SafeSubscriberTestException("error!")); fail("expects exception to be thrown"); } catch (Exception e) { assertTrue(e instanceof SafeSubscriberTestException); assertEquals("onErrorFail", e.getMessage()); } }
@Test public void onErrorFailure() { try { OBSERVER_ONERROR_FAIL().onError(new SafeObserverTestException("error!")); fail("expects exception to be thrown"); } catch (Exception e) { assertTrue(e instanceof SafeObserverTestException); assertEquals("onErrorFail", e.getMessage()); } }