Added HTTP Header 'X-Description' to API error responses.

For easy access to API error descriptions in the CloudBridge.
This commit is contained in:
Ragnar B. Johannsson 2011-01-11 18:27:03 +00:00
parent a013640180
commit ee923e5797

View File

@ -267,6 +267,7 @@ public class ApiServlet extends HttpServlet {
writeResponse(resp, response != null ? response : "", HttpServletResponse.SC_OK, responseType);
} catch (ServerApiException se) {
String serializedResponseText = _apiServer.getSerializedApiError(se.getErrorCode(), se.getDescription(), params, responseType);
resp.setHeader("X-Description", se.getDescription());
writeResponse(resp, serializedResponseText, se.getErrorCode(), responseType);
auditTrailSb.append(" " +se.getErrorCode() + " " + se.getDescription());
}