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:
Igor Mandrigin 2018-05-18 12:55:20 +02:00
parent f4ec87d36b
commit d304063cda
No known key found for this signature in database
GPG Key ID: 4A0EDDE26E66BC8B
1 changed files with 12 additions and 12 deletions

View File

@ -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)))))