Skip to content

Commit

Permalink
fixed submission error conversion issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sivaksb committed Oct 1, 2024
1 parent cb0dd1e commit 9eef205
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import gov.cms.qpp.conversion.api.services.ValidationService;
import gov.cms.qpp.conversion.correlation.PathCorrelator;
import gov.cms.qpp.conversion.encode.JsonWrapper;
import gov.cms.qpp.conversion.model.error.AllErrors;
import gov.cms.qpp.conversion.model.error.*;
import gov.cms.qpp.conversion.model.error.Error;
import gov.cms.qpp.conversion.model.error.QppValidationException;
import gov.cms.qpp.conversion.util.JsonHelper;

import org.slf4j.Logger;
Expand All @@ -29,6 +28,7 @@

import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;

/**
* Implementation for the QPP Validation Service
Expand Down Expand Up @@ -153,20 +153,20 @@ AllErrors convertQppValidationErrorsToQrda(String validationResponse, JsonWrappe
return errors;
}

Error error = getError(validationResponse);

error.getDetails().forEach(detail -> {
detail.setMessage(SV_LABEL + detail.getMessage());
String newPath = UNABLE_PROVIDE_XPATH;
try {
try {
Error error = getError(validationResponse);
error.getDetails().forEach(detail -> {
String newPath = UNABLE_PROVIDE_XPATH;
detail.setMessage(SV_LABEL + detail.getMessage());
newPath = PathCorrelator.prepPath(detail.getLocation().getPath(), wrapper);
} catch (ClassCastException | JsonPathException exc) {
API_LOG.warn("Failed to convert from json path to an XPath.", exc);
}
detail.getLocation().setPath(newPath);
});

errors.addError(error);
detail.getLocation().setPath(newPath);
});
errors.addError(error);
} catch (Exception exception) {
API_LOG.warn("Failed to convert from json path to an XPath.", exception);
List<Detail> details = List.of(Detail.forProblemCode(ProblemCode.UNEXPECTED_ERROR));
errors.addError(new Error("CT", details));
}

return errors;
}
Expand Down

0 comments on commit 9eef205

Please sign in to comment.