From 28450cdeab937f6f38358e10f1256fbae97ce6f2 Mon Sep 17 00:00:00 2001 From: codez0mb1e Date: Mon, 17 Oct 2022 22:44:14 +0000 Subject: [PATCH] Processing exceptions --- src/bitfinex_crypto_parser.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bitfinex_crypto_parser.py b/src/bitfinex_crypto_parser.py index 20a386b..2084877 100644 --- a/src/bitfinex_crypto_parser.py +++ b/src/bitfinex_crypto_parser.py @@ -133,7 +133,11 @@ for pair in usd_pairs: print(f'INFO | {pair} > Starting insert to DB...') print('DEBUG | {} rows from {} to {}'.format(df.shape[0], min(df['time']), max(df['time']))) - db_conn.insert(df, 'crypto', db_mapping) + try: + db_conn.insert(df, 'crypto', db_mapping) + except Exception as ex: + print(f'ERROR | {pair} > {ex}') + else: print(f'WARN | {pair} > No new records') else: