esgf_core_utils.models.exceptions

Exception used by ESGF packages.

Exceptions

MissingPermissionException

Raised when a user does not possess a required permission.

RFC9457Exception

Base class for RFC 9457 Exceptions.

OperationNotPermittedException

Raised when a requested patch operation is not permitted.

ExtensionValidationException

Raised when an error occuse during extension validation.

UnexpectedExtensionException

Raised when an unexpected extension is supplied.

ExpectedExtensionsMissingException

Raised when one or more required extensions are missing.

ExtensionBelowMinimumException

Raised when an extension version is below the minimum allowed version.

InvalidTokenAudienceException

Raised when an OAuth token was issued for the wrong audience.

InvalidTokenException

Raised when issue found with the OAuth token.

STACValidationException

Raised when a STAC document fails validation.

AuthorizationException

Raised when the caller is not authorised to perform an operation.

ItemAlreadyExistsException

Raised when attempting to create an item that already exists.

ItemDoesNotExistException

Raised when attempting to update an item that does not exist.

PayloadTooLargeException

Raised when a request exceeds the maximum message size that can be published.

UnknownException

Raised when an unexpected internal server error occurs.

Classes

RFC9457Response

RFC 9457 Response.

Package Contents

class esgf_core_utils.models.exceptions.RFC9457Response

Bases: TypedDict

RFC 9457 Response.

type: str
title: str
status: int
detail: str
instance: str
exception esgf_core_utils.models.exceptions.MissingPermissionException

Bases: Exception

Raised when a user does not possess a required permission.

type: str
target: str
role: str = ''
__str__() → str

Exception message.

exception esgf_core_utils.models.exceptions.RFC9457Exception

Bases: Exception

Base class for RFC 9457 Exceptions.

instance: str = ''
status_code: ClassVar[int]
type: ClassVar[str]
title: ClassVar[str]
property detail: str
Abstractmethod:

Details of exception.

property status: int

HTTP status code.

__str__() → str

Exception message.

rfc945response() → RFC9457Response

RFC9457 Response.

exception esgf_core_utils.models.exceptions.OperationNotPermittedException

Bases: RFC9457Exception

Raised when a requested patch operation is not permitted.

op: str
status_code: ClassVar[int] = 400
type: ClassVar[str] = 'https://esgf.io/publication/errors/operation-not-permitted'
title: ClassVar[str] = 'The operation you attempted is not permitted'
property detail: str

Details of exception.

exception esgf_core_utils.models.exceptions.ExtensionValidationException

Bases: RFC9457Exception

Raised when an error occuse during extension validation.

extension: str
detail: str

Details of exception.

status_code: ClassVar[int] = 400
type: ClassVar[str] = 'https://esgf.io/publication/errors/unexpected-extension'
title: ClassVar[str] = 'There is an unexpected extension in your request'
exception esgf_core_utils.models.exceptions.UnexpectedExtensionException

Bases: RFC9457Exception

Raised when an unexpected extension is supplied.

extension: str
status_code: ClassVar[int] = 400
type: ClassVar[str] = 'https://esgf.io/publication/errors/unexpected-extension'
title: ClassVar[str] = 'There is an unexpected extension in your request'
property detail: str

Details of exception.

exception esgf_core_utils.models.exceptions.ExpectedExtensionsMissingException

Bases: RFC9457Exception

Raised when one or more required extensions are missing.

extensions: list[str]
status_code: ClassVar[int] = 400
type: ClassVar[str] = 'https://esgf.io/publication/errors/expected-extension-missing'
title: ClassVar[str] = 'A required extension is missing from your request'
property detail: str

Details of exception.

exception esgf_core_utils.models.exceptions.ExtensionBelowMinimumException

Bases: RFC9457Exception

Raised when an extension version is below the minimum allowed version.

extension: str
minimum_version: str
status_code: ClassVar[int] = 400
type: ClassVar[str] = 'https://esgf.io/publication/errors/extension-below-minimum'
title: ClassVar[str] = 'There is an extension in your request below the minimum allowed version'
property detail: str

Details of exception.

exception esgf_core_utils.models.exceptions.InvalidTokenAudienceException

Bases: RFC9457Exception

Raised when an OAuth token was issued for the wrong audience.

token_audience: str
expected_audience: str
status_code: ClassVar[int] = 401
type: ClassVar[str] = 'https://esgf.io/publication/errors/invalid-token-audience'
title: ClassVar[str] = 'Invalid token audience'
property detail: str

Details of exception.

exception esgf_core_utils.models.exceptions.InvalidTokenException

Bases: RFC9457Exception

Raised when issue found with the OAuth token.

status_code: ClassVar[int] = 401
type: ClassVar[str] = 'https://esgf.io/publication/errors/invalid-token'
title: ClassVar[str] = 'Invalid token'
property detail: str

Details of exception.

exception esgf_core_utils.models.exceptions.STACValidationException

Bases: RFC9457Exception

Raised when a STAC document fails validation.

status_code: ClassVar[int] = 400
type: ClassVar[str] = 'https://esgf.io/publication/errors/stac-validation'
title: ClassVar[str] = 'Your request is invalid'
detail: str = 'Your request is invalid -- please ensure your request is valid and try again.'

Details of exception.

exception esgf_core_utils.models.exceptions.AuthorizationException

Bases: RFC9457Exception

Raised when the caller is not authorised to perform an operation.

status_code: ClassVar[int] = 403
type: ClassVar[str] = 'https://esgf.io/publication/errors/missing-permission'
title: ClassVar[str] = 'You do not have permission'
property detail: str

Details of exception.

exception esgf_core_utils.models.exceptions.ItemAlreadyExistsException

Bases: RFC9457Exception

Raised when attempting to create an item that already exists.

collection: str
item: str
status_code: ClassVar[int] = 409
type: ClassVar[str] = 'https://esgf.io/publication/errors/item-already-exists'
title: ClassVar[str] = 'The Item you attempted to publish already exists'
property detail: str

Details of exception.

exception esgf_core_utils.models.exceptions.ItemDoesNotExistException

Bases: RFC9457Exception

Raised when attempting to update an item that does not exist.

collection: str
item: str
status_code: ClassVar[int] = 404
type: ClassVar[str] = 'https://esgf.io/publication/errors/item-does-not-exist'
title: ClassVar[str] = 'The Item you attempted to update does not exist'
property detail: str

Details of exception.

exception esgf_core_utils.models.exceptions.PayloadTooLargeException

Bases: RFC9457Exception

Raised when a request exceeds the maximum message size that can be published.

status_code: ClassVar[int] = 413
type: ClassVar[str] = 'https://esgf.io/publication/errors/payload-too-large'
title: ClassVar[str] = 'Your request is too large'
property detail: str

Details of exception.

exception esgf_core_utils.models.exceptions.UnknownException

Bases: RFC9457Exception

Raised when an unexpected internal server error occurs.

status_code: ClassVar[int] = 500
type: ClassVar[str] = 'https://esgf.io/publication/errors/unknown'
title: ClassVar[str] = 'An unidentified server side error occurred'
property detail: str

Details of exception.