File: raise_test_exception.py

package info (click to toggle)
python-django-extensions 4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,820 kB
  • sloc: python: 18,601; javascript: 7,354; makefile: 108; xml: 17
file content (23 lines) | stat: -rw-r--r-- 659 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand

from django_extensions.management.utils import signalcommand


class DjangoExtensionsTestException(Exception):
    pass


class Command(BaseCommand):
    help = (
        "Raises a test Exception named DjangoExtensionsTestException. "
        "Useful for debugging integration with error reporters like Sentry."
    )

    @signalcommand
    def handle(self, *args, **options):
        message = (
            "This is a test exception via the "
            "django-extensions raise_test_exception management command."
        )
        raise DjangoExtensionsTestException(message)