fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
19 lines (18 loc) • 976 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReferenceException = void 0;
class ReferenceException extends Error {
constructor(value, resources = '', path = 'Reference.reference') {
if (!value)
throw new Error('ReferenceException. Value is required');
let message = `ReferenceException. Value: '${value}'. Reference must be in the format {ResourceType}/{id}. Path: ${path}`;
if (resources && typeof resources === 'string' && resources === 'all') {
message = `ReferenceException. Value: '${value}'. ResourceType can be any FHIR resource type. Path: ${path}`;
}
if (resources && Array.isArray(resources) && resources.length > 0) {
message = `ReferenceException. Value: '${value}'. ResourceType must be one of the following: '${resources.join(', ')}'. Path: ${path}`;
}
super(message);
}
}
exports.ReferenceException = ReferenceException;