From 2581f8ab4d9abbeb8280a0ceb4d403060bf365c1 Mon Sep 17 00:00:00 2001 From: Christian Gill Date: Tue, 19 May 2020 15:23:13 +0200 Subject: [PATCH] join errors to one exception --- app/server/management/commands/create_admin.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/server/management/commands/create_admin.py b/app/server/management/commands/create_admin.py index e9e5fdb9..5ab297e5 100644 --- a/app/server/management/commands/create_admin.py +++ b/app/server/management/commands/create_admin.py @@ -20,10 +20,9 @@ class Command(createsuperuser.Command): try: super().handle(*args, **options) - except IntegrityError: + self.stderr.write(f'try executed') + except (IntegrityError, CommandError) as e: self.stderr.write(f'User {username} already exists.') - except CommandError: - pass if password: database = options.get('database')