mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-27 01:41:07 +00:00
Merge pull request #364 from martinklepsch/throw-if-no-gas
throw if eth-rpc returns error
This commit is contained in:
commit
bf639c17b7
@ -127,13 +127,17 @@
|
||||
result (safe-read-str (:body response))]
|
||||
(log/debug body "\n" result)
|
||||
|
||||
(if (= (:id result) request-id)
|
||||
(:result result)
|
||||
(do
|
||||
(log/error "Geth returned an invalid json-rpc request ID,"
|
||||
"ignoring response")
|
||||
(when-let [error (:error result)]
|
||||
(log/error "Method: " method ", error: " error))))))
|
||||
(cond
|
||||
;; Ignore any responses that have mismatching request ID
|
||||
(not= (:id result) request-id)
|
||||
(log/error "Geth returned an invalid json-rpc request ID, ignoring response")
|
||||
|
||||
;; If request ID matches but contains error, throw
|
||||
(:error result)
|
||||
(throw (ex-info "Error submitting transaction via eth-rpc" (:error result)))
|
||||
|
||||
:else
|
||||
(:result result))))
|
||||
|
||||
(defn hex->big-integer
|
||||
[hex]
|
||||
|
Loading…
x
Reference in New Issue
Block a user