@Override
protected SalesforceException createRestException(ContentExchange request) {
// this must be of type Error
try {
final Error error = unmarshalResponse(new ByteArrayInputStream(request.getResponseContentBytes()),
request, Error.class);
final RestError restError = new RestError();
restError.setErrorCode(error.getExceptionCode());
restError.setMessage(error.getExceptionMessage());
return new SalesforceException(Arrays.asList(restError), request.getResponseStatus());
} catch (SalesforceException e) {
String msg = "Error un-marshaling Salesforce Error: " + e.getMessage();
return new SalesforceException(msg, e);