Django Exception Classes (core/exceptions.py)

django · django/core/exceptions.py · python · BSD-3-Clause
infra, lang:python, fw:django, tag:exceptions, tag:error-handling, tag:web

Core exception hierarchy for the Django web framework, including security and database errors. Reuse for error handling in Django-based applications.

# Source: https://github.com/django/django | License: BSD-3-Clause | Copyright Django Software Foundation and individual contributors
# Provided via justclaw.it.com; keep this notice with the code.
"""
Global Django exception classes.
"""

import operator

from django.utils.hashable import make_hashable


class FieldDoesNotExist(Exception):
    """The requested model field does not exist"""

    pass


class AppRegistryNotReady(Exception):
    """The django.apps registry is not populated yet"""

    pass


class ObjectDoesNotExist(Exception):
    """The requested object does not exist"""

    silent_variable_failure = True


class ObjectNotUpdated(Exception):
    """The updated object no longer exists."""


class MultipleObjectsReturned(Exception):
    """The query returned multiple object

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key