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 RuntimeException mapTargetToRuntimeEx(Throwable throwable) { if (throwable instanceof WebApplicationException) { return (WebApplicationException) throwable; } // handle all exceptions as potentially mappable (incl. ProcessingException) return new MappableException(throwable); }
@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); } }
@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); } }
@Override public void run() { try { requestScopeListener.resume(foreignScopeInstance, responder.runtime.injectionManager); responder.process(new MappableException(error)); } catch (final Throwable error) { // Ignore the exception - already resumed but may be rethrown by ContainerResponseWriter#failure. } } });
@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); } }
@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); } }
@Override public void run() { try { requestScopeListener.resume(foreignScopeInstance, responder.runtime.injectionManager); responder.process(new MappableException(error)); } catch (final Throwable error) { // Ignore the exception - already resumed but may be rethrown by ContainerResponseWriter#failure. } } });
throw new MappableException("Exception obtaining parameters", e);
throw new MappableException("Exception obtaining parameters", e);
@Override public void onEvent(RequestEvent event) { final RequestEvent.Type eventType = event.getType(); if (eventType == RequestEvent.Type.RESOURCE_METHOD_START) { Optional<UnitOfWork> unitOfWork = methodMap.computeIfAbsent(event.getUriInfo() .getMatchedResourceMethod(), UnitOfWorkEventListener::registerUnitOfWorkAnnotations); unitOfWorkAspect.beforeStart(unitOfWork.orElse(null)); } else if (eventType == RequestEvent.Type.RESP_FILTERS_START) { try { unitOfWorkAspect.afterEnd(); } catch (Exception e) { throw new MappableException(e); } } else if (eventType == RequestEvent.Type.ON_EXCEPTION) { unitOfWorkAspect.onError(); } else if (eventType == RequestEvent.Type.FINISHED) { unitOfWorkAspect.onFinish(); } }
throw new MappableException(ex);
throw new MappableException(ex);
throw new MappableException(cause); } catch (final Throwable t) { throw new ProcessingException(t);
filter.filter(request, responseContext); } catch (Exception ex) { throw new MappableException(ex); } finally { processedCount++;
throw new MappableException(cause); } catch (final Throwable t) { throw new ProcessingException(t);
filter.filter(request, responseContext); } catch (Exception ex) { throw new MappableException(ex); } finally { processedCount++;
filter.filter(request); } catch (Exception exception) { throw new MappableException(exception); } finally { processedCount++;
filter.filter(request); } catch (Exception exception) { throw new MappableException(exception); } finally { processedCount++;
throw (RuntimeException) ex; } else { throw new MappableException(ex);