Skip to main content

exceptions

Exceptions related to NextGen interactions.

Classes

FHIRR4APIError

class FHIRR4APIError(*args, **kwargs):

Exception raised when interacting with FHIR R4 APIs.

Ancestors

FHIRR4AuthenticationError

class FHIRR4AuthenticationError(    status_code: int, message: str, response_content: str | None = None,):

Exception for authentication/authorization errors (401).

FHIRR4DataError

class FHIRR4DataError(*args, **kwargs):

Exception raised when we have exceeded any FHIR R4 call limit.

FHIRR4ForbiddenError

class FHIRR4ForbiddenError(    status_code: int, message: str, response_content: str | None = None,):

Exception for forbidden access (403).

FHIRR4HTTPError

class FHIRR4HTTPError(    status_code: int, message: str, response_content: str | None = None,):

Exception for HTTP errors from FHIR R4 API.

FHIRR4OperationOutcomeError

class FHIRR4OperationOutcomeError(*args, **kwargs):

Exception for server side operation errors.

These can be raised even when server returns a 200, accompanied by an OperationOutcome resource that details

FHIRR4QuotaExceeded

class FHIRR4QuotaExceeded(*args, **kwargs):

Exception raised when we have exceeded any FHIR R4 call limit.

FHIRR4RateLimitError

class FHIRR4RateLimitError(    status_code: int, message: str, response_content: str | None = None,):

Exception for rate limiting errors (429).

FHIRR4ResourceTypeNotSupportedError

class FHIRR4ResourceTypeNotSupportedError(resource_type: str, message: str | None = None):

Raised when the server does not support a requested resource type.

Some FHIR servers answer a request for a resource type they do not implement with a 404 (rather than an empty bundle). This is a permanent, server-wide condition — unlike a per-patient "not found" — so callers can stop re-requesting the type for the remainder of the run.

Subclasses ResourceNotFound so existing handlers that treat the type as "no data" continue to work unchanged; callers that want to short-circuit catch this more specific type first.

Also subclasses EHRFetchUnsupportedError, which is what lets it travel: the querier entry points convert every non-auth failure into a FHIRR4GetPatientInfoError so their callers only ever have to catch GetPatientInfoError, and a bare ResourceNotFound is not one. Being an EHRFetchUnsupportedError — and so a GetPatientInfoError — this can be let through those entry points unconverted, carrying "the server cannot serve this type" all the way to the consumer that has to tell a structural gap from an outage. That is the same claim FHIRServerCapabilities records; the registry remains the within-run short-circuit that stops the type being requested again, not the channel the claim travels down.

warning

That inheritance makes the default for a new handler the unsafe one: an except ResourceNotFound written without thinking about this will report a permanently-absent resource type as "this patient has none", which readers treat as a confirmed negative. Any handler that means "not found for this patient" must catch this type first and re-raise. Every current site does (_get_resource, _first_resource, _search_resources); the one deliberate exception is the per-resource-type medications loop, where "unavailable" really is the intended reading.

Arguments

  • resource_type: The resource type the server does not support.
  • message: Optional diagnostic detail from the server's OperationOutcome.

FHIRR4ServerError

class FHIRR4ServerError(    status_code: int, message: str, response_content: str | None = None,):

Exception for server errors (5xx).

NoFHIRR4PatientIDError

class NoFHIRR4PatientIDError(*args, **kwargs):

Exception raised when patient ID could not be extracted.

NoMatchingFHIRR4PatientError

class NoMatchingFHIRR4PatientError(*args, **kwargs):

Exception raised when no patient matching filters is found.

NonSpecificFHIRR4PatientError

class NonSpecificFHIRR4PatientError(*args, **kwargs):

Exception raised when patient could not be narrowed to a single person.