Browse Source

Update exception raising

critical errors are now raised

Co-authored-by: Alexander Kurakin <kuraga333@mail.ru>
pull/787/head
Christian Gill 4 years ago
committed by GitHub
parent
commit
20d16c8ea8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions
  1. 7
      app/server/management/commands/create_admin.py

7
app/server/management/commands/create_admin.py

@ -20,8 +20,11 @@ class Command(createsuperuser.Command):
try: try:
super().handle(*args, **options) super().handle(*args, **options)
except (IntegrityError, CommandError):
self.stderr.write(f'User {username} already exists.')
except Exception as err:
if 'is already taken' in str(err):
self.stderr.write(f'User {username} already exists.')
else:
raise
if password: if password:
database = options.get('database') database = options.get('database')

Loading…
Cancel
Save