add comment if database is not imported

This commit is contained in:
Emmanuel Garette 2020-03-13 12:24:33 +01:00
parent 8bec9c7ce1
commit d6bbcaa65c
1 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@ from os.path import isdir, join
from sys import exit from sys import exit
from risotto.utils import _
from risotto.config import get_config from risotto.config import get_config
@ -21,7 +22,11 @@ async def main():
if filename.endswith('.sql'): if filename.endswith('.sql'):
sql_filename = join(sql_dir, filename) sql_filename = join(sql_dir, filename)
with open(sql_filename, 'r') as sql: 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__': if __name__ == '__main__':