Opened 10 years ago

Closed 10 years ago

#8464 closed (duplicate)

Django should allow exceptions to bubble up from urlconf imports

Reported by: bendavis78@… Owned by: nobody
Component: Core (Other) Version: 1.0-alpha-2
Severity: Keywords: ImproperlyConfigured urconf exception traceback
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Exceptions are very hard to debug when they occur during a urlconf import. In django.core.urlresolvers._get_urlconf_module(), it wraps the import line in a try/except, and throws a new ImproperlyConfigured exception if any type of Exception is encountered. This means the only information available to the developer through the django debug page is the error message of the original exception, and not the traceback information (which is equally as important as the message itself, imho). That is, the original traceback information is lost because django throws a new exception.

Because there is potentially a lot of code that gets executed during an import, I believe _get_urlconf_module() should allow the exception to bubble up. This will make urlconf import issues much easier to debug. I don't see much advantage gained from the way it does it now.

Change History (1)

comment:1 Changed 10 years ago by Malcolm Tredinnick

Resolution: duplicate
Status: newclosed

This is essentially a dupe of #7524.

Note: See TracTickets for help on using tickets.
Back to Top