- client.executeCommand(clientCommand, baos);\r
- response.append(baos.toString("UTF-8"));\r
+ Pazpar2HttpResponse httpResponse = client.executeCommand(clientCommand, baos);\r
+ if (httpResponse.getStatusCode()==200) {\r
+ response.append(baos.toString("UTF-8")); \r
+ } else if (httpResponse.getStatusCode()==417) {\r
+ logger.error("Pazpar2 status code 417: " + baos.toString("UTF-8"));\r
+ response.append(CommandError.insertPazpar2ErrorXml(command.getName(), "Expectation failed (417)", baos.toString("UTF-8"))); \r
+ } else {\r
+ String resp = baos.toString("UTF-8");\r
+ logger.error("Pazpar2 status code was " + httpResponse.getStatusCode() + ": " + resp);\r
+ throw new Pazpar2ErrorException(resp,httpResponse.getStatusCode(),resp,null);\r
+ } \r