$expand with an invalid filter returns 500 instead of 422 #516

Closed
jimsteel opened this Issue Nov 24, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@jimsteel

POSTing a ValueSet to $expand, where the valueset uses an invalid filter operator, results in an IllegalArgumentException. It would be good if this could be caught somewhere and thrown as a UnprocessableEntityException, so it comes out as a 422 response.

Example follows.

curl -X POST -H "Content-Type: application/json+fhir" -H "Cache-Control: no-cache" -d '{ "resourceType": "ValueSet", "url": "http://sample/ValueSet/education-levels", "version": "1", "name": "Education Levels", "status": "draft", "compose": { "include": [ { "filter": [ { "property": "n", "op": "n", "value": "365460000" } ], "system": "http://snomed.info/sct" } ], "exclude": [ { "concept": [ { "code": "224298008" }, { "code": "365460000" }, { "code": "473462005" }, { "code": "424587006" } ], "system": "http://snomed.info/sct" } ] }, "description": "A selection of Education Levels", "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h2>Education Levels</h2><tt>http://csiro.au/ValueSet/education-levels</tt><p>A selection of Education Levels</p></div>" }, "experimental": true, "date": "2016-07-26" }' "http://fhirtest.uhn.ca/baseDstu3/ValueSet/%24expand"

lawley added a commit to aehrc/hapi-fhir that referenced this issue Dec 6, 2016

jamesagnew added a commit that referenced this issue Dec 10, 2016

Merge pull request #525 from aehrc/feature/parser_exception_handling
#516 Report invalid values for enums through parser error handler
@jamesagnew

This comment has been minimized.

Show comment
Hide comment
@jamesagnew

jamesagnew Dec 10, 2016

Owner

Thanks for reporting! Checking in a fix now.

FYI the fix for #525 had the side effect that this invalid code would now be ignored entirely and the server would just ignore the filter. With the checkin about to come, the server return an HTTP 400 when it receives an invalid code (unless the parserErrorHandler has been configured to ignore this problem)

Owner

jamesagnew commented Dec 10, 2016

Thanks for reporting! Checking in a fix now.

FYI the fix for #525 had the side effect that this invalid code would now be ignored entirely and the server would just ignore the filter. With the checkin about to come, the server return an HTTP 400 when it receives an invalid code (unless the parserErrorHandler has been configured to ignore this problem)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment