use of org.onap.so.serviceinstancebeans.PolicyException in project so by onap.
the class MsoRequest method buildServiceErrorResponse.
public Response buildServiceErrorResponse(int httpResponseCode, MsoException exceptionType, String errorText, String messageId, List<String> variables, String version) {
if (errorText.length() > 1999) {
errorText = errorText.substring(0, 1999);
}
RequestError re = new RequestError();
if ("PolicyException".equals(exceptionType.name())) {
PolicyException pe = new PolicyException();
pe.setMessageId(messageId);
pe.setText(errorText);
if (variables != null) {
for (String variable : variables) {
pe.getVariables().add(variable);
}
}
re.setPolicyException(pe);
} else {
ServiceException se = new ServiceException();
se.setMessageId(messageId);
se.setText(errorText);
if (variables != null) {
for (String variable : variables) {
se.getVariables().add(variable);
}
}
re.setServiceException(se);
}
return builder.buildResponse(httpResponseCode, null, re, version);
}
Aggregations