class GraphExceptionMappingService extends AbstractExceptionMappingService<OneDriveAPIException> {

    @Override
    public BackgroundException map(final OneDriveAPIException failure) {
        if(failure.getResponseCode() > 0) {
            final StringAppender buffer = new StringAppender();
            buffer.append(failure.getMessage());
            buffer.append(failure.getErrorMessage());
            return new DefaultHttpResponseExceptionMappingService().map(new HttpResponseException(failure.getResponseCode(), buffer.toString()));
        }
        if(ExceptionUtils.getRootCause(failure) != failure && ExceptionUtils.getRootCause(failure) instanceof IOException) {
            return new DefaultIOExceptionMappingService().map((IOException) ExceptionUtils.getRootCause(failure));
        }
        return new InteroperabilityException(failure.getMessage(), failure);
    }

}