logError(event.getException()); break;
event.getContainerRequest().setProperty("http.route", maybeHttpRoute); serverHandler.handleSend(event, event.getException(), span); break; default:
public class ExceptionLogger implements ApplicationEventListener, RequestEventListener { private static final Logger log = LoggerFactory.getLogger(RequestExceptionLogger.class); @Override public void onEvent(final ApplicationEvent applicationEvent) { } @Override public RequestEventListener onRequest(final RequestEvent requestEvent) { return this; } @Override public void onEvent(RequestEvent paramRequestEvent) { if(paramRequestEvent.getType() == Type.ON_EXCEPTION) { log.error("", paramRequestEvent.getException()); } } }
/** * <p>getException.</p> * * @return a {@link java.lang.Throwable} object. */ public Throwable getException() { return event.getException(); }
/** {@inheritDoc} */ public void onEvent(RequestEvent reqEvt) { if (RequestEvent.Type.ON_EXCEPTION.equals(reqEvt.getType())) { logger.error("An error occured when processing " + reqEvt.getContainerRequest().getRequestUri(), reqEvt.getException() ); logger.error(" + Type : " + reqEvt.getException().getClass().getName()); logger.error(" + Message : " + reqEvt.getException().getMessage()); } else { logger.debug(reqEvt.getContainerRequest().getRequestUri() + "[" + reqEvt.getType() + "]"); } }
@Override public void onEvent(RequestEvent event) { if (event.getType() == RequestEvent.Type.ON_EXCEPTION) { final ResourceMethod method = event.getUriInfo().getMatchedResourceMethod(); final ExceptionMeterMetric metric = (method != null) ? this.exceptionMeters.get(method.getInvocable().getDefinitionMethod()) : null; if (metric != null) { if (metric.cause.isAssignableFrom(event.getException().getClass()) || (event.getException().getCause() != null && metric.cause.isAssignableFrom(event.getException().getCause().getClass()))) { metric.meter.mark(); } } } } }
public void onEvent(final RequestEvent event) { if (event.getType().equals(Type.ON_EXCEPTION)) { logger.error("REST Exception", event.getException()); } }
/** * Creates a {@code exception} tag based on the {@link Class#getSimpleName() simple * name} of the class of the given {@code exception}. * @param event the request event * @return the exception tag derived from the exception */ public static Tag exception(RequestEvent event) { Throwable exception = event.getException(); if (exception == null) { return EXCEPTION_NONE; } ContainerResponse response = event.getContainerResponse(); if (response != null) { int status = response.getStatus(); if (status == 404 || isRedirection(status)) { return EXCEPTION_NONE; } } if (exception.getCause() != null) { exception = exception.getCause(); } String simpleName = exception.getClass().getSimpleName(); return Tag.of("exception", StringUtils.isNotEmpty(simpleName) ? simpleName : exception.getClass().getName()); }
@Override public void onEvent(RequestEvent event) { if (event.getType() == RequestEvent.Type.FINISHED) { final ResourceMethod method = event.getUriInfo().getMatchedResourceMethod(); final ResponseMeterMetric metric = (method != null) ? this.responseMeters.get(method.getInvocable().getDefinitionMethod()) : null; if (metric != null) { ContainerResponse containerResponse = event.getContainerResponse(); if (containerResponse == null) { if (event.getException() != null) { metric.meters.get(4).mark(); } } else { final int responseStatus = containerResponse.getStatus() / 100; if (responseStatus >= 1 && responseStatus <= 5) { metric.meters.get(responseStatus - 1).mark(); } } } } } }
if (!(event.getException() instanceof NotFoundException)) { break;
((Timer.Context) event.getContainerRequest().getProperty("metricsContext")).stop(); nova.metrics.getCounter("rest", eventId, "total").inc(); if (event.getException() != null) { nova.metrics.getCounter("rest", eventId, "errors").inc();
switch (type) { case ON_EXCEPTION: Throwable error = event.getException(); if (error != null) { Class<?> errorClass = error.getClass();