Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#17369 closed Bug (duplicate)

Useless error messages in management command execution

Reported by: valexeev Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

Right now BaseCommand.execute catches errors and outputs quite useless portions of them.

For example, I'm trying to move quite large (and, unfortunately, underdocumented) project from server to server. I know that I need to install a few components, but I do not precisely know which. So I just try running "runserver" command and fixing any errors occuring.

But soon an error like this appears:

Error: No module named exceptions

Ok, how can this error message help me to learn what's the problem? In my opinion, it can't.

But when I remove the try-catch from aforementioned method, I get a helpful traceback:

Traceback (most recent call last):
  File "manage.py", line 13, in <module>
    execute_manager(settings)
[...]
  File "/[...]/utils.py", line 2, in <module>
    from sqlalchemy.exceptions import OperationalError
ImportError: No module named exceptions

Oh, now I see that I obviously have problems with sqlalchemy installation. The source of the problem is pinned down and quickly fixed.

The question is: what's the reason of having this try-catch in the first place, if it serves only to turn a helpful traceback into a useless 1-line error message? In my opinion, it should be removed altogether.

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

This appears to be a duplicate of #16397 and #11667.

comment:2 Changed 3 years ago by aaugustin

In [17197]:

Fixed #16397 -- Respected the --traceback flag in BaseCommand. This should make import loops easier to debug. Refs #11667, #17369.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.