private static RuntimeException mapTargetToRuntimeEx(Throwable throwable) { if (throwable instanceof WebApplicationException) { return (WebApplicationException) throwable; } // handle all exceptions as potentially mappable (incl. ProcessingException) return new MappableException(throwable); }
private static Throwable unwrap(Throwable cause) { if (cause instanceof MappableException) { do { MappableException mce = (MappableException) cause; cause = mce.getCause(); } while (cause instanceof MappableException); } return cause; } }
/** * Construct a new mappable exception with the supplied message and cause. * * @param message the exception message. * @param cause the exception cause. */ public MappableException(String message, Throwable cause) { super(message, unwrap(cause)); }
request.getWriterInterceptors())); } catch (final MappableException mpe) { if (mpe.getCause() instanceof IOException) { connectionCallbackRunner.onDisconnect(processingContext.asyncContext()); throw (RuntimeException) ex; } else { throw new MappableException(ex);
request.getWriterInterceptors())); } catch (final MappableException mpe) { if (mpe.getCause() instanceof IOException) { connectionCallbackRunner.onDisconnect(processingContext.asyncContext()); throw (RuntimeException) ex; } else { throw new MappableException(ex);
private static RuntimeException mapTargetToRuntimeEx(Throwable throwable) { if (throwable instanceof WebApplicationException) { return (WebApplicationException) throwable; } // handle all exceptions as potentially mappable (incl. ProcessingException) return new MappableException(throwable); }
request.getWriterInterceptors())); } catch (final MappableException mpe) { if (mpe.getCause() instanceof IOException) { connectionCallbackRunner.onDisconnect(processingContext.asyncContext()); throw (RuntimeException) ex; } else { throw new MappableException(ex);
/** * Construct a mappable container exception. * * @param cause the cause. If the cause is an instance of * {@link MappableException} then the cause of this exception * will be obtained by recursively searching though the exception * causes until a cause is obtained that is not an instance of * {@code MappableException}. */ public MappableException(Throwable cause) { super(unwrap(cause)); }
private static Throwable unwrap(Throwable cause) { if (cause instanceof MappableException) { do { MappableException mce = (MappableException) cause; cause = mce.getCause(); } while (cause instanceof MappableException); } return cause; } }
@Override public Object aroundReadFrom(final ReaderInterceptorContext context) throws IOException, WebApplicationException { try { return context.proceed(); } catch (final WebApplicationException | MappableException | MessageBodyProviderNotFoundException e) { throw e; } catch (final Exception e) { throw new MappableException(e); } }
request.getWriterInterceptors())); } catch (final MappableException mpe) { if (mpe.getCause() instanceof IOException) { connectionCallbackRunner.onDisconnect(processingContext.asyncContext()); throw (RuntimeException) ex; } else { throw new MappableException(ex);
/** * Construct a mappable container exception. * * @param cause the cause. If the cause is an instance of * {@link MappableException} then the cause of this exception * will be obtained by recursively searching though the exception * causes until a cause is obtained that is not an instance of * {@code MappableException}. */ public MappableException(Throwable cause) { super(unwrap(cause)); }
private static Throwable unwrap(Throwable cause) { if (cause instanceof MappableException) { do { MappableException mce = (MappableException) cause; cause = mce.getCause(); } while (cause instanceof MappableException); } return cause; } }
@Override public Object aroundReadFrom(final ReaderInterceptorContext context) throws IOException, WebApplicationException { try { return context.proceed(); } catch (final WebApplicationException | MappableException | MessageBodyProviderNotFoundException e) { throw e; } catch (final Exception e) { throw new MappableException(e); } }
request.getWriterInterceptors())); } catch (final MappableException mpe) { if (mpe.getCause() instanceof IOException) { connectionCallbackRunner.onDisconnect(processingContext.asyncContext()); throw (RuntimeException) ex; } else { throw new MappableException(ex);
/** * Construct a new mappable exception with the supplied message and cause. * * @param message the exception message. * @param cause the exception cause. */ public MappableException(String message, Throwable cause) { super(message, unwrap(cause)); }
throw ioe; } catch (final MappableException mpe) { if (mpe.getCause() instanceof IOException) { connectionCallback.onDisconnect(asyncContext);
@Override public void aroundWriteTo(final WriterInterceptorContext context) throws IOException, WebApplicationException { try { context.proceed(); } catch (final WebApplicationException | MappableException e) { throw e; } catch (final MessageBodyProviderNotFoundException nfe) { throw new InternalServerErrorException(nfe); } catch (final Exception e) { throw new MappableException(e); } }
request.getWriterInterceptors())); } catch (final MappableException mpe) { if (mpe.getCause() instanceof IOException) { connectionCallbackRunner.onDisconnect(processingContext.asyncContext()); throw (RuntimeException) ex; } else { throw new MappableException(ex);
/** * Construct a new mappable exception with the supplied message and cause. * * @param message the exception message. * @param cause the exception cause. */ public MappableException(String message, Throwable cause) { super(message, unwrap(cause)); }