fix: handle exceptions in xmr data logging
Some checks are pending
Docker / build (push) Waiting to run
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:
parent
250061876c
commit
831867dfb1
1 changed files with 15 additions and 11 deletions
|
@ -795,6 +795,8 @@ def update_database(date_from=None, date_to=None):
|
||||||
data.crypto_postsPerHour = 0
|
data.crypto_postsPerHour = 0
|
||||||
|
|
||||||
data.save()
|
data.save()
|
||||||
|
|
||||||
|
try:
|
||||||
print(
|
print(
|
||||||
str(coin_xmr.supply)
|
str(coin_xmr.supply)
|
||||||
+ " xmr "
|
+ " xmr "
|
||||||
|
@ -806,6 +808,8 @@ def update_database(date_from=None, date_to=None):
|
||||||
+ " => "
|
+ " => "
|
||||||
+ str(coin_xmr.inflation)
|
+ str(coin_xmr.inflation)
|
||||||
)
|
)
|
||||||
|
except (Social.DoesNotExist, UnboundLocalError):
|
||||||
|
pass
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue