httk.serve.optimade.model.errors

Exceptions

OptimadeError

Represent an OPTIMADE response error.

TranslatorError

Represent a filter translation failure with an HTTP response contract.

Functions

translator_error_from(error)

Wrap a neutral FilterTranslationError for HTTP output.

Module Contents

exception httk.serve.optimade.model.errors.OptimadeError(message, response_code, response_message, longmsg=None)[source]

Bases: Exception

Represent an OPTIMADE response error.

Parameters:
  • message (str) – Short error detail used as the exception message.

  • response_code (int) – HTTP status code returned to the client.

  • response_message (str) – HTTP status title returned to the client.

  • longmsg (str | None) – Optional longer error detail returned in the response.

response_code[source]
response_msg[source]
content[source]
exception httk.serve.optimade.model.errors.TranslatorError(message, response_code, response_message, longmsg=None)[source]

Bases: OptimadeError

Represent a filter translation failure with an HTTP response contract.

httk.serve.optimade.model.errors.translator_error_from(error)[source]

Wrap a neutral FilterTranslationError for HTTP output.

Parameters:

error (httk.store.FilterTranslationError) – Neutral filter translation failure to classify.

Returns:

A translated error carrying the corresponding HTTP status.

Return type:

TranslatorError