Better handle error conditions

This commit is contained in:
Lloyd McKenzie 2022-01-10 10:29:47 -07:00
parent cb583208d4
commit 195872a9cc
2 changed files with 6 additions and 7 deletions

View File

@ -498,7 +498,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
// nup, don't have it locally (or it's expired)
FilesystemPackageCacheManager.InputStreamWithSrc source;
if ("current".equals(version) || version.startsWith("current$")) {
if ("current".equals(version) || (version!= null && version.startsWith("current$"))) {
// special case - fetch from ci-build server
source = loadFromCIBuild(id, version.startsWith("current$") ? version.substring(8) : null);
} else {

View File

@ -256,10 +256,10 @@ public class ValidationService {
public void compile(CliContext cliContext, ValidationEngine validator) throws Exception {
if (cliContext.getSources().size() > 0)
throw new Exception("Cannot specify sources when compling transform (found " + cliContext.getSources() + ")");
// if (cliContext.getTxServer() == null)
// throw new Exception("Must provide a terminology server when compiling a transform");
if (cliContext.getMap() == null)
throw new Exception("Must provide a map when compiling a transform");
if (cliContext.getOutput() == null)
throw new Exception("Must provide an output name when compiling a transform");
try {
List<StructureDefinition> structures = validator.getContext().allStructures();
for (StructureDefinition sd : structures) {
@ -272,12 +272,11 @@ public class ValidationService {
}
}
validator.setMapLog(cliContext.getMapLog());
cliContext.getMap();
StructureMap map = validator.compile(cliContext.getMap());
if (map == null)
throw new Exception("Unable to locate map " + cliContext.getMap());
validator.handleOutput(map, cliContext.getOutput(), validator.getVersion());
System.out.println(" ...success");
if (cliContext.getOutput() != null) {
validator.handleOutput(map, cliContext.getOutput(), validator.getVersion());
}
} catch (Exception e) {
System.out.println(" ...Failure: " + e.getMessage());
e.printStackTrace();