fix: handle exceptions in xmr data logging
Some checks are pending
Docker / build (push) Waiting to run

Added a try-except block when printing XMR-related data to handle potential exceptions such as missing social data or uninitialized variables. This prevents the application from crashing due to `Social.DoesNotExist` or `UnboundLocalError`, enhancing robustness and ensuring smoother operation.
This commit is contained in:
Kumi 2024-11-13 16:18:33 +01:00
parent 250061876c
commit 831867dfb1
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -795,6 +795,8 @@ def update_database(date_from=None, date_to=None):
data.crypto_postsPerHour = 0
data.save()
try:
print(
str(coin_xmr.supply)
+ " xmr "
@ -806,6 +808,8 @@ def update_database(date_from=None, date_to=None):
+ " => "
+ str(coin_xmr.inflation)
)
except (Social.DoesNotExist, UnboundLocalError):
pass
count += 1