fix(Transactions.get()): Adding extra error handling for rate limits

This commit is contained in:
Chris Troutner
2021-08-08 18:38:46 -07:00
parent 40ba334a41
commit 547b28cac8
+10
View File
@@ -131,6 +131,11 @@ class Transaction {
} catch (err) {
// console.log('Error: ', err)
// This case handles rate limit errors.
if (err.response && err.response.data && err.response.data.error) {
throw new Error(err.response.data.error)
}
// If decoding the op_return fails, then it's not an SLP transaction,
// and the non-hyrated TX details can be returned.
return txDetails
@@ -140,6 +145,11 @@ class Transaction {
} catch (err) {
// console.error('Error in transactions.js/get(): ', err)
// This case handles rate limit errors.
if (err.response && err.response.data && err.response.data.error) {
throw new Error(err.response.data.error)
}
if (err.error) throw new Error(err.error)
throw err
}