taking care of errros.
This commit is contained in:
@@ -25,6 +25,16 @@
|
||||
(log/error "yodlee Error." ex)
|
||||
false)}))
|
||||
|
||||
(defn retry-thrice
|
||||
([x] (retry-thrice x 0))
|
||||
([x i]
|
||||
(try
|
||||
(x)
|
||||
(catch Exception e
|
||||
(if (>= i 3)
|
||||
(throw e)
|
||||
(retry-thrice x (inc i)))))))
|
||||
|
||||
(def base-headers {"Api-Version" "1.1"
|
||||
"Cobrand-Name" (:yodlee-cobrand-name env)
|
||||
"Content-Type" "application/json"})
|
||||
@@ -75,12 +85,14 @@
|
||||
(try
|
||||
(let [cob-session (login-cobrand)
|
||||
user-session (login-user cob-session)]
|
||||
(-> (str (:yodlee-base-url env) "/accounts?providerAccountId=" provider-account-id)
|
||||
(client/get (merge {:headers (merge base-headers {"Authorization" (auth-header cob-session user-session)})
|
||||
:as :json}
|
||||
other-config))
|
||||
:body
|
||||
:account))
|
||||
(retry-thrice
|
||||
(fn []
|
||||
(-> (str (:yodlee-base-url env) "/accounts?providerAccountId=" provider-account-id)
|
||||
(client/get (merge {:headers (merge base-headers {"Authorization" (auth-header cob-session user-session)})
|
||||
:as :json}
|
||||
other-config))
|
||||
:body
|
||||
:account))))
|
||||
(catch Exception e
|
||||
(log/error (str "Couldn't get accounts for provider account '" provider-account-id "'")
|
||||
e)
|
||||
|
||||
Reference in New Issue
Block a user