@Override public Representation represent(Variant variant) throws ResourceException { try { return super.represent(variant); } catch (ResourceException e) { // NEXUS-4238, NEXUS-4290 // if it's server error based on HTTP Code, but NOT when Nexus throws a known 503 // (see // org.sonatype.nexus.rest.AbstractResourceStoreContentPlexusResource.handleException(Request, // Response, Exception)) final Status status = e.getStatus(); if (status == null) { handleError(e); } else { final int code = status.getCode(); if (Status.isServerError(code) && Status.SERVER_ERROR_SERVICE_UNAVAILABLE.getCode() != code) { handleError(e); } } throw e; } catch (RuntimeException e) { handleError(e); throw e; } }
@Override public void removeRepresentations() throws ResourceException { try { super.removeRepresentations(); } catch (ResourceException e) { if (Status.isServerError(e.getStatus().getCode())) { handleError(e); } throw e; } catch (RuntimeException e) { handleError(e); throw e; } }