Catch exceptions during token value formatting

This commit is contained in:
Vitaliy Vlasov 2018-03-12 17:31:47 +02:00
parent fdabe1e3a7
commit 5888d70801
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964

View File

@ -146,7 +146,11 @@
(defn prettify-bounty-items [bounty-items]
(let [renames {:user_name :display-name
(let [format-float (fn [balance]
(try
(format "%.2f" balance)
(catch java.util.IllegalFormatConversionException ex "0.00")))
renames {:user_name :display-name
:user_avatar_url :avatar-url
:issue_title :issue-title
:type :item-type
@ -164,7 +168,7 @@
(update :tokens (fn [tokens]
(into {}
(map (fn [[tla balance]]
[tla (format "%.2f" balance)])
[tla (format-float balance)])
tokens)))))
bounty-items)))