Use `if-not` for error handling in ethereum core functions.
That fixes the exception if we have an error that isn't a string and does not conform to `ISeqable`. Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
parent
f4ec87d36b
commit
d304063cda
|
@ -109,24 +109,24 @@
|
||||||
(defn get-block-number [web3 cb]
|
(defn get-block-number [web3 cb]
|
||||||
(.getBlockNumber (.-eth web3)
|
(.getBlockNumber (.-eth web3)
|
||||||
(fn [error result]
|
(fn [error result]
|
||||||
(if (seq error)
|
(if-not error
|
||||||
(handle-error error)
|
(cb result)
|
||||||
(cb result)))))
|
(handle-error error)))))
|
||||||
|
|
||||||
(defn get-block-info [web3 number cb]
|
(defn get-block-info [web3 number cb]
|
||||||
(.getBlock (.-eth web3) number (fn [error result]
|
(.getBlock (.-eth web3) number (fn [error result]
|
||||||
(if (seq error)
|
(if-not error
|
||||||
(handle-error error)
|
(cb (js->clj result :keywordize-keys true))
|
||||||
(cb (js->clj result :keywordize-keys true))))))
|
(handle-error error)))))
|
||||||
|
|
||||||
(defn get-transaction [web3 number cb]
|
(defn get-transaction [web3 number cb]
|
||||||
(.getTransaction (.-eth web3) number (fn [error result]
|
(.getTransaction (.-eth web3) number (fn [error result]
|
||||||
(if (seq error)
|
(if-not error
|
||||||
(handle-error error)
|
(cb (js->clj result :keywordize-keys true))
|
||||||
(cb (js->clj result :keywordize-keys true))))))
|
(handle-error error)))))
|
||||||
|
|
||||||
(defn get-transaction-receipt [web3 number cb]
|
(defn get-transaction-receipt [web3 number cb]
|
||||||
(.getTransactionReceipt (.-eth web3) number (fn [error result]
|
(.getTransactionReceipt (.-eth web3) number (fn [error result]
|
||||||
(if (seq error)
|
(if-not error
|
||||||
(handle-error error)
|
(cb (js->clj result :keywordize-keys true))
|
||||||
(cb (js->clj result :keywordize-keys true))))))
|
(handle-error error)))))
|
||||||
|
|
Loading…
Reference in New Issue