Problem: No error handling for invalid election ids

Solution: Send an error message to `logger.error` if bigchain fails to get the election, then `return`
This commit is contained in:
z-bowen 2018-08-28 17:47:40 +02:00
parent 4a08abf4e8
commit 800a2dc791

View File

@ -203,6 +203,9 @@ def run_upsert_validator_show(args, bigchain):
""" """
election = bigchain.get_transaction(args.election_id) election = bigchain.get_transaction(args.election_id)
if not election:
logger.error(f'No election found with election_id {args.election_id}')
return
new_validator = election.asset['data'] new_validator = election.asset['data']