aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/manage.py
diff options
context:
space:
mode:
authorAlexis M <alexis@notmyidea.org>2019-10-11 22:25:59 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2019-10-14 16:52:02 +0200
commit95d4891857666c11fa4cddf7e5fb887d1b82e464 (patch)
tree1f4d916f9328a6b39f6406ccb46f333bc02ed61b /ihatemoney/manage.py
parent21c2ef1775ba57323bac8cc5156ca033b0468c3e (diff)
downloadihatemoney-mirror-95d4891857666c11fa4cddf7e5fb887d1b82e464.zip
ihatemoney-mirror-95d4891857666c11fa4cddf7e5fb887d1b82e464.tar.gz
ihatemoney-mirror-95d4891857666c11fa4cddf7e5fb887d1b82e464.tar.bz2
Add errors to the output if they arise.
Diffstat (limited to 'ihatemoney/manage.py')
-rwxr-xr-xihatemoney/manage.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/ihatemoney/manage.py b/ihatemoney/manage.py
index a9eca0f..8e73bc9 100755
--- a/ihatemoney/manage.py
+++ b/ihatemoney/manage.py
@@ -67,18 +67,25 @@ class DeleteProject(Command):
def main():
QUIET_COMMANDS = ('generate_password_hash', 'generate-config')
+ exception = None
backup_stderr = sys.stderr
# Hack to divert stderr for commands generating content to stdout
# to avoid confusing the user
if len(sys.argv) > 1 and sys.argv[1] in QUIET_COMMANDS:
sys.stderr = open(os.devnull, 'w')
- app = create_app()
- Migrate(app, db)
+ try:
+ app = create_app()
+ Migrate(app, db)
+ except Exception as e:
+ exception = e
- # Restore stderr (among other: to be able to display help)
+ # Restore stderr
sys.stderr = backup_stderr
+ if exception:
+ raise exception
+
manager = Manager(app)
manager.add_command('db', MigrateCommand)
manager.add_command('generate_password_hash', GeneratePasswordHash)