-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FhirClient throws wrong exception when server returns an HTTP error and non-FHIR body #1013
Comments
Hi Michele, this is caused by the new parser framework, which threw the wrong exception when illegal FHIR was encountered. This was fixed in PR #906, which was published in release 1.2. At the time of the PR, this file was called I can now see that this fix was applied to R4, but is not present in the STU3 version. I'll chase down what happened there. |
Ah, I had noticed I had lost this and tried to correct it in ac6d6fa. I was not careful enough :-( |
Fixed by #1022 |
Thanks Ewout - sorry to be a pest but it appears that DSTU2 needs it as well (that's the develop branch isn't it?) |
Ah, yes - we have ceased active development of DSTU2, but if you need me to selectively apply this patch, I will do so. |
Ah OK - no thanks, I am good, I just used the latest ElementModel package in our own fork of Core and that solves the problem for us |
If the remote server respond to a request with an HTTP error and a JSON or XML body that is not valid FHIR (that can happen when connecting by mistake to non-FHIR end points or when the error is generated by the server before hitting the actual FHIR code - like an authorization error) the resulting exception is ArgumentException instead of FhirOperationException, and the returned HTTP status code is lost.
Test:
The problem appear to be at https://github.com/FirelyTeam/fhir-net-api/blob/develop-stu3/src/Hl7.Fhir.ElementModel/TypedElementOnSourceNode.cs#L42: it should throw a
FormatException
(?)The text was updated successfully, but these errors were encountered: