Skip to content
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

Incorrect exception message for resourceType passed as empty in FhirJsonParser #1397

Closed
rotodd opened this issue Jun 13, 2020 · 4 comments
Closed
Assignees

Comments

@rotodd
Copy link

rotodd commented Jun 13, 2020

We merged release 1.7.0 in PR1049 and are still seeing the same issue detailed in #1304.

@marcovisserFurore
Copy link
Member

Ai, that should have happened. We will investigate this as soon as possible

@marcovisserFurore
Copy link
Member

Hi @rotodd, I investigated this issue and I created the following unit test for it:

       [TestMethod]
        public void Issue_1304()
        {
            var json = "{\"resourceType\": \"\",  \"id\": \"example\" }";

            var sr = new StringReader(json);
            var jsonreader = new JsonTextReader(sr);
            var parser = new FhirJsonParser();

            var exceptionThrown = false;

            try
            {
                _ = parser.Parse(jsonreader);
            }
            catch (InvalidOperationException ex)
            {
                exceptionThrown = true;
                Assert.IsTrue(ex.Message.Contains("Root object has no type indication (resourceType) and therefore cannot be used to construct an FhirJsonNode."));
            }
            catch (Exception)
            {
                Assert.Fail("Other exceptions are not expected");
            }

            Assert.IsTrue(exceptionThrown, "InvalidOperationException was expected.");
        }

This unittest does succeed. It throws now an InvalidOperationException with the message that the resourceType is missing. In the past a FormatException was thrown with the message Cannot locate type information for type.

What kind of exception do you receive in your code with fhir-net-api 1.7?

@marcovisserFurore
Copy link
Member

@rotodd : can you confirm that the issue has been solved? If yes, I will close this issue.

@marcovisserFurore
Copy link
Member

I close this issue, because there is no response and the unittest proves that the issue has been solved in 1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants