hapi-fhir icon indicating copy to clipboard operation
hapi-fhir copied to clipboard

Add an IOperationOutcome to AuthenticationException's constructor

Open RadixSeven opened this issue 2 years ago • 0 comments

Describe the issue Please add an overload that takes an IOperationOutcome to AuthenticationException's constructors.

We are implementing a Plain Server for dbGaP's FHIR API.

The FHIR standard requires an operation outcome for failed searches. (And it's polite even if not required.) However, throwing AuthenticationException from an "@Search" method does not result in an OperationOutcome - just the message labeled as "text/plain". The constructors do not provide a way to supply an OperationOutcome. We will want to throw a similar AuthenticationException from "@Read"

I noticed this today and want our server to be conformant. So, when we get around to fixing it, we'll use an UnclassifiedServerFailureException, since its constructors do allow an OperationOutcome. However, the appropriate error would be an AuthenticationException.

Environment (please complete the following information):

  • HAPI FHIR Version: 5.7.2
  • OS: Linux
  • Browser: Any

Additional context The quote from the standard referenced above:

If the search fails (cannot be executed, not that there are no matches), the return value return value [sic] SHALL be a status code 4xx or 5xx with an OperationOutcome.

RadixSeven avatar Aug 09 '22 20:08 RadixSeven