From d6bbcaa65c9722967ed9365378c461deeaba2ed5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 13 Mar 2020 12:24:33 +0100 Subject: [PATCH] add comment if database is not imported --- script/database_manager.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/script/database_manager.py b/script/database_manager.py index f4f754d..ec3f271 100644 --- a/script/database_manager.py +++ b/script/database_manager.py @@ -5,6 +5,7 @@ from os.path import isdir, join from sys import exit +from risotto.utils import _ from risotto.config import get_config @@ -21,7 +22,11 @@ async def main(): if filename.endswith('.sql'): sql_filename = join(sql_dir, filename) with open(sql_filename, 'r') as sql: - await connection.execute(sql.read()) + try: + await connection.execute(sql.read()) + except Exception as err: + print(_(f'unable to import {filename}: {err}')) + exit(1) if __name__ == '__main__':