Closed cmoesel closed 1 year ago
The following simple project demonstrates the issue: StartsWithError.zip
Note that if you run the test project using PR #1331 and the -l debug
flag, you'll get the exact location of where the error is being thrown. But (spoiler alert), it's here: https://github.com/FHIR/sushi/blob/45c944ac0c91bdab8c7d2eaec20559590dcd27f0/src/export/InstanceExporter.ts#L789
Given FSH like the following:
SUSHI will emit the following error:
Cannot read properties of undefined (reading 'startsWith')
This is because the InstanceExporter is trying to check if the
meta.profile
value starts with a particular string -- but in this case, althoughmeta.profile
is not null, it does not yet have an assigned value. In fact, the code where this is happening is the code that is intended to set themeta.profile
value based on theInstanceOf
. Oops.