Skip to content

Commit 3a1eb96

Browse files
authored
Merge pull request #90 from NHSDigital/patch
add comments to errors/warnings common.js.ts
2 parents 60f693d + 2ab5483 commit 3a1eb96

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/common.js.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,22 @@ function getErrorOrWarningFull(issue: OperationOutcomeIssue) {
250250
}
251251
return error;
252252
}
253+
// raiseWarning function allows the custom raising (true) or ignoring (false) of warnings when testing files
253254
function raiseWarning(issue: OperationOutcomeIssue, failOnWarning:boolean): boolean {
254255
if (issue != undefined && issue.diagnostics != undefined) {
255256

256257
//THESE WARNINGS SHOULD ALWAYS ERROR
257258
if (issue.diagnostics.includes('incorrect type for element')) {
258259
return true;
259260
}
261+
// unauthorised requests
260262
if (issue.diagnostics.includes('Error HTTP 401')) {
261263
return true;
262264
}
263265

264266
// THESE WARNINGS SHOULD ALWAYS BE SILENTLY IGNORED
265267
//if (issue.diagnostics.includes('Code system https://dmd.nhs.uk/ could not be resolved.')) return false
268+
// Issue with hapi giving incorrect error when one code is from the valueset, but another is not. See https://github.com/hapifhir/hapi-fhir/issues/4152
266269
if (issue.diagnostics.includes('Inappropriate CodeSystem URL') && issue.diagnostics.includes('for ValueSet: http://hl7.org/fhir/ValueSet/all-languages')) {
267270
return false
268271
}
@@ -281,12 +284,13 @@ function raiseWarning(issue: OperationOutcomeIssue, failOnWarning:boolean): bool
281284
// if error not handled above, return error if FailOnWarning is true
282285
return failOnWarning;
283286
}
287+
// raiseError function allows the custom raising (true) or ignoring (false) of errors when testing files
284288
function raiseError(issue: OperationOutcomeIssue) : boolean {
285289
if (issue != undefined) {
286290
if (issue.diagnostics != undefined) {
287291
// List of errors to ALWAYS ignore
288292

289-
// languages, known issue!
293+
// Issue with hapi giving incorrect error when one code is from the valueset, but another is not. See https://github.com/hapifhir/hapi-fhir/issues/4152
290294
if (issue.diagnostics.includes('Inappropriate CodeSystem URL') && issue.diagnostics.includes('for ValueSet: http://hl7.org/fhir/ValueSet/all-languages')) {
291295
return false
292296
}

0 commit comments

Comments
 (0)