Skip to content

Commit 8974c24

Browse files
committed
Raise exceptions rather than return None in some trx calls
1 parent c5f8655 commit 8974c24

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tronapi/trx.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ def get_block(self, block: Any = None):
6565
if_number={'url': '/wallet/getblockbynum', 'field': 'num'},
6666
)
6767

68-
response = self.tron.manager.request(method['url'], {
68+
result = self.tron.manager.request(method['url'], {
6969
method['field']: block
7070
})
71-
return response
71+
72+
if result:
73+
return result
74+
return ValueError("The call to {method['url']} did not return a value.")
7275

7376
def get_transaction_count_by_blocknum(self, num: int):
7477
"""Query transaction's count on a specified block by height

0 commit comments

Comments
 (0)