summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2020-04-14 08:54:46 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-04-14 13:22:47 +0200
commit8bd9000a7db3dcf14b003e8ef18137ea1296c07b (patch)
treea731b6da2902cda4368a2a205175b8fb8f91e428
parent8189976663eb160bfd4b2ae44fd5250da1089744 (diff)
Refs #29501 -- Made dbshell catch more specific FileNotFoundError.
-rw-r--r--django/core/management/commands/dbshell.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/django/core/management/commands/dbshell.py b/django/core/management/commands/dbshell.py
index 1cb6b52f04..6782ef48f3 100644
--- a/django/core/management/commands/dbshell.py
+++ b/django/core/management/commands/dbshell.py
@@ -20,11 +20,11 @@ class Command(BaseCommand):
connection = connections[options['database']]
try:
connection.client.runshell()
- except OSError:
- # Note that we're assuming OSError means that the client program
- # isn't installed. There's a possibility OSError would be raised
- # for some other reason, in which case this error message would be
- # inaccurate. Still, this message catches the common case.
+ except FileNotFoundError:
+ # Note that we're assuming the FileNotFoundError relates to the
+ # command missing. It could be raised for some other reason, in
+ # which case this error message would be inaccurate. Still, this
+ # message catches the common case.
raise CommandError(
'You appear not to have the %r program installed or on your path.' %
connection.client.executable_name