Skip to content

# `nautobot.apps.exceptions`

Exceptions for Nautobot apps.

## `nautobot.apps.exceptions.AbortTransaction`

Bases: `Exception`

An exception used to trigger a database transaction rollback.

Source code in `nautobot/core/exceptions.py`

    6
    7
    8
    9
    class AbortTransaction(Exception):
        """
        An exception used to trigger a database transaction rollback.
        """

## `nautobot.apps.exceptions.CeleryWorkerNotRunningException`

Bases: `APIException`

Indicates the temporary inability to enqueue a new Celery task (e.g. custom script execution) because no Celery worker processes are currently running.

Source code in `nautobot/core/exceptions.py`

    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    class CeleryWorkerNotRunningException(APIException):
        """
        Indicates the temporary inability to enqueue a new Celery task (e.g. custom script execution) because
        no Celery worker processes are currently running.
        """

        status_code = status.HTTP_503_SERVICE_UNAVAILABLE
        default_detail = (
            f"Unable to process request: No celery workers running on queue {settings.CELERY_TASK_DEFAULT_QUEUE}."
        )
        default_code = "celery_worker_not_running"

        def __init__(self, queue=None):
            if queue:
                detail = f"Unable to process request: No celery workers running on queue {queue}."
            else:
                detail = self.default_detail
            super().__init__(detail=detail)

## `nautobot.apps.exceptions.FilterSetFieldNotFound`

Bases: `Exception`

An exception indicating that a filterset field could not be found.

Source code in `nautobot/core/exceptions.py`

    32
    33
    34
    35
    class FilterSetFieldNotFound(Exception):
        """
        An exception indicating that a filterset field could not be found.
        """

## `nautobot.apps.exceptions.SecretError`

Bases: `Exception`

General purpose exception class for failures raised when secret value access fails.

Source code in `nautobot/extras/secrets/exceptions.py`

     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    class SecretError(Exception):
        """General purpose exception class for failures raised when secret value access fails."""

        def __init__(self, secret, provider_class, message, *args, **kwargs):
            super().__init__(message, *args, **kwargs)
            self.secret = secret
            # provider_class can be a SecretsProvider class or just a descriptive string.
            if isinstance(provider_class, type):
                self.provider_class = provider_class
                self.provider = provider_class.__name__
            else:
                self.provider_class = None
                self.provider = str(provider_class)
            self.message = message

        def __str__(self):
            return f'{self.__class__.__name__}: Secret "{self.secret}" (provider "{self.provider}"): {self.message}'

## `nautobot.apps.exceptions.SecretParametersError`

Bases: `SecretError`

Exception raised when a Secret record's parameters are incorrectly specified.

Normally this should be caught during input validation of the Secret record, but in the case of direct ORM access bypassing the usual clean() functionality, it's possible to create a mis-defined Secret which would trigger this exception upon access.

Source code in `nautobot/extras/secrets/exceptions.py`

    23
    24
    25
    26
    27
    28
    29
    class SecretParametersError(SecretError):
        """Exception raised when a Secret record's parameters are incorrectly specified.

        Normally this should be caught during input validation of the Secret record, but in the case of direct
        ORM access bypassing the usual clean() functionality, it's possible to create a mis-defined Secret which
        would trigger this exception upon access.
        """

## `nautobot.apps.exceptions.SecretProviderError`

Bases: `SecretError`

General purpose exception class for failures that indicate that a secrets provider is not working correctly.

Source code in `nautobot/extras/secrets/exceptions.py`

    36
    37
    class SecretProviderError(SecretError):
        """General purpose exception class for failures that indicate that a secrets provider is not working correctly."""

## `nautobot.apps.exceptions.SecretValueNotFoundError`

Bases: `SecretError`, `KeyError`

Exception raised when a secrets provider is operating normally but a specific requested secret is not found.

Source code in `nautobot/extras/secrets/exceptions.py`

    32
    33
    class SecretValueNotFoundError(SecretError, KeyError):
        """Exception raised when a secrets provider is operating normally but a specific requested secret is not found."""

## `nautobot.apps.exceptions.ViewConfigException`

Bases: `Exception`

An exception indicating that a detail view config is invalid.

Source code in `nautobot/core/exceptions.py`

    38
    39
    40
    41
    class ViewConfigException(Exception):
        """
        An exception indicating that a detail view config is invalid.
        """