Skip to content

Commit 8bd9000

Browse files
adamchainzfelixxm
authored andcommitted
Refs #29501 -- Made dbshell catch more specific FileNotFoundError.
1 parent 8189976 commit 8bd9000

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

django/core/management/commands/dbshell.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def handle(self, **options):
2020
connection = connections[options['database']]
2121
try:
2222
connection.client.runshell()
23-
except OSError:
24-
# Note that we're assuming OSError means that the client program
25-
# isn't installed. There's a possibility OSError would be raised
26-
# for some other reason, in which case this error message would be
27-
# inaccurate. Still, this message catches the common case.
23+
except FileNotFoundError:
24+
# Note that we're assuming the FileNotFoundError relates to the
25+
# command missing. It could be raised for some other reason, in
26+
# which case this error message would be inaccurate. Still, this
27+
# message catches the common case.
2828
raise CommandError(
2929
'You appear not to have the %r program installed or on your path.' %
3030
connection.client.executable_name

0 commit comments

Comments
 (0)