Closed radupurdea closed 6 months ago
Ha, this is not going to be very informative indeed: $"expected a body of type {typeof(TResource).Name} but a {typeof(TResource).Name} was returned.";
, that's twice typeof(TResource).Name
. Thanks for spotting it!
It will become "Operation GET......expected a body type of Bundle, but a ImagingStudy was returned". We don't really interpret the search string to figure out what kind of search results should be in the Bundle. And by the way, because of the _include
feature, the Bundle could contain other types of resources than the one you are searching for
!
When doing a Http request, if the bundle returns an unexpected body type, the error message is incorrect.
Please see lines 909 and 912 of
BaseFhirClient
. https://github.com/FirelyTeam/firely-net-sdk/blob/dc32002c616baac8e7518eb587aae210f1d345ba/src/Hl7.Fhir.Base/Rest/BaseFhirClient.cs#L909To Reproduce Steps to reproduce the behavior: This could be reproduced in unit tests by returning a different resource type than requested.
IFhirSerializationEngine
and have it return a resource type ofImagingStudy
(for example)FhirOperationException : Operation GET on <URL HERE> expected a body of type Bundle but a Bundle was returned.
Expected behavior The message in the exception should indicate the unexpected resource type: The above code will throw:
FhirOperationException : Operation GET on <URL HERE> expected a body of type Practitioner but a ImagingStudy was returned.
Note: I am assuming the message here was to indicate the types of resources within the bundle entries...
Version used: