Skip to content

Commit

Permalink
moving conditional to ValueSetExporter
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelynJefferson committed Dec 2, 2024
1 parent 23a9e2f commit a48662b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
7 changes: 6 additions & 1 deletion src/export/ValueSetExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,12 @@ export class ValueSetExporter {
});
}
}

if (conceptIndex === undefined) {
logger.error(
`This rule is invalid. There is no concept array in the compose element with the code system: ${system}.`
);
return;
}
if (conceptIndex !== -1) {
if (rule.isInstance) {
const instanceExporter = new InstanceExporter(this.tank, this.pkg, this.fisher);
Expand Down
9 changes: 1 addition & 8 deletions src/fhirtypes/StructureDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,14 +691,7 @@ export class StructureDefinition {
) {
// We throw an error if the currentElement doesn't exist, has been zeroed out,
// or is being incorrectly accessed as an array
if (currentPath == 'compose.include.concept[undefined]') {
throw new Error(
'This rule is invalid. There is no concept array in the compose element with the code system: code_system.'
);
// TODO: code system --> fisher.tank.docs[0].valueSets[0].value.rules[0].from.system
} else {
throw new CannotResolvePathError(path);
}
throw new CannotResolvePathError(path);
}

// Determine if base and/or current are arrays. Note that this is not perfect (if base or current max is missing),
Expand Down
4 changes: 2 additions & 2 deletions test/export/ValueSetExporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,8 @@ describe('ValueSetExporter', () => {
const exported = exporter.export().valueSets;
expect(exported.length).toBe(1);
expect(loggerSpy.getAllMessages('error')).toHaveLength(1);
expect(loggerSpy.getLastMessage('error')).toMatch(
/This rule is invalid. There is no concept array in the compose element with the code system: code_system/
expect(loggerSpy.getLastMessage('error')).toBe(
'This rule is invalid. There is no concept array in the compose element with the code system: http://example.org/CS.'
);
});

Expand Down

0 comments on commit a48662b

Please sign in to comment.