public void handleException( final ODataRequest request, final ODataResponse response, final ODataServerError serverError, final Exception exception) { lastThrownException = exception; ErrorProcessor exceptionProcessor; try { exceptionProcessor = selectProcessor(ErrorProcessor.class); } catch (ODataHandlerException e) { // This cannot happen since there is always an ExceptionProcessor registered. exceptionProcessor = new DefaultProcessor(); } ContentType requestedContentType; try { requestedContentType = ContentNegotiator.doContentNegotiation( uriInfo == null ? null : uriInfo.getFormatOption(), request, getCustomContentTypeSupport(), RepresentationType.ERROR); } catch (final ContentNegotiatorException e) { requestedContentType = ContentType.JSON; } final int measurementHandle = debugger.startRuntimeMeasurement("ErrorProcessor", "processError"); exceptionProcessor.processError(request, response, serverError, requestedContentType); debugger.stopRuntimeMeasurement(measurementHandle); }