This is the way errors was handled in the Tiani solution. This code is a part from the epSOS-Web and how it handled the errorCodes from the tiani solution. The advantage with using Objects for this is that you can handle more then one exception which is the case for CDA. That can have really many errors or partial errors. As its done in the openNCP only one error is handled since its throwing an exception directly in the code. One thing that was also in the object that tiani had was the actual exception offcourse.
if (!rsp.getPartialErros().isEmpty()) { for (int i = 0; i < rsp.getPartialErros().size(); i++) { ErrorFeedback error = new ErrorFeedback(); error.setErrorCode(rsp.getPartialErros().get(i).getErrorCode()); error.setErrorMessage(rsp.getPartialErros().get(i).getCodeContext()); error.setSeverityType(rsp.getPartialErros().get(i).getSeverity()); errorList.add(error); } }