public BackgroundException map(HttpResponse response) throws IOException {
        final S3ServiceException failure;
        if(null == response.getEntity()) {
            failure = new S3ServiceException(response.getStatusLine().getReasonPhrase());
        }
        else {
            EntityUtils.updateEntity(response, new BufferedHttpEntity(response.getEntity()));
            failure = new S3ServiceException(response.getStatusLine().getReasonPhrase(),
                    EntityUtils.toString(response.getEntity()));
        }
        failure.setResponseCode(response.getStatusLine().getStatusCode());
        if(response.containsHeader(MINIO_ERROR_CODE)) {
            failure.setErrorCode(response.getFirstHeader(MINIO_ERROR_CODE).getValue());
        }
        if(response.containsHeader(MINIO_ERROR_DESCRIPTION)) {
            failure.setErrorMessage(response.getFirstHeader(MINIO_ERROR_DESCRIPTION).getValue());
        }
        return this.map(failure);
    }
@Test
    public void testWrapped() {
        assertEquals("Access Denied. Please contact your web hosting service provider for assistance.", new S3ExceptionMappingService().map(new ServiceException(new S3ServiceException("m",
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>D84EDAE486BD2D71</RequestId><HostId>tVNWw2hK+FVpFnWUVf2LdDM6rgtjo/cibINRUVc/HpqMZbgNTg311LSltHYvRQdX</HostId></Error>"))).getDetail()
        );
    }