aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorNikhilBartwal <nikhilbartwal1234@gmail.com>2021-07-29 15:31:55 +0530
committerNikhilBartwal <nikhilbartwal1234@gmail.com>2021-08-05 02:58:07 +0530
commitb0c8246cac97b7792a50afc22ef1fe39c5028e00 (patch)
treec868eec99180941803bd3688758d124680cdde39 /contrib
parent1c612b274b1587c43ee6e6a486aed653b9ca5f70 (diff)
downloadbitcoin-b0c8246cac97b7792a50afc22ef1fe39c5028e00.tar.xz
Add cleaner errors for unsuccessful faucet transactions
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/signet/getcoins.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/signet/getcoins.py b/contrib/signet/getcoins.py
index 0a8e762ff0..c50c2cc16a 100755
--- a/contrib/signet/getcoins.py
+++ b/contrib/signet/getcoins.py
@@ -48,4 +48,15 @@ try:
except:
print('Unexpected error when contacting faucet:', sys.exc_info()[0])
exit()
-print(res.text)
+
+# Display the output as per the returned status code
+if res:
+ # When the return code is in between 200 and 400 i.e. successful
+ print(res.text)
+elif res.status_code == 404:
+ print('The specified faucet URL does not exist. Please check for any server issues/typo.')
+elif res.status_code == 429:
+ print('The script does not allow for repeated transactions as the global faucet is rate-limitied to 1 request/IP/day. You can access the faucet website to get more coins manually')
+else:
+ print(f'Returned Error Code {res.status_code}\n{res.text}\n')
+ print('Please check the provided arguments for their validity and/or any possible typo.')