if (ms.find() && mm.find()) {
String status = ms.group(1);
String errorMessage = mm.group(1);
// revert status code to 200 to match actual server's return status
response = response.toBuilder().statusCode(200).build();
exception = refineException(new HttpResponseException(command, response, status + ": " + errorMessage));
}
}
} catch (UnsupportedEncodingException e) {
// should never happen as UTF-8 is always supported
} finally {
if (exception == null) {
exception = new HttpResponseException(command, response);
}
command.setException(exception);
releasePayload(response);
}
}