Makes square more resilent when catalog changes
This commit is contained in:
@@ -141,15 +141,23 @@
|
||||
(defn item->category-name-impl [client item ]
|
||||
(capture-context->lc
|
||||
(cond (:item_id (:item_variation_data item))
|
||||
(de/chain (fetch-catalog-cache client (:item_id (:item_variation_data item)))
|
||||
(fn [item]
|
||||
(mu/with-context lc
|
||||
(item->category-name-impl client item))))
|
||||
(de/catch (de/chain (fetch-catalog-cache client (:item_id (:item_variation_data item)))
|
||||
(fn [item]
|
||||
(mu/with-context lc
|
||||
(item->category-name-impl client item))))
|
||||
(fn [e]
|
||||
(log/error ::couldnt-fetch-variation
|
||||
:exception e)
|
||||
"Uncategorized"))
|
||||
|
||||
(:category_id (:item_data item))
|
||||
(de/chain (fetch-catalog-cache client (:category_id (:item_data item)))
|
||||
:category_data
|
||||
:name)
|
||||
(de/catch (de/chain (fetch-catalog-cache client (:category_id (:item_data item)))
|
||||
:category_data
|
||||
:name)
|
||||
(fn [e]
|
||||
(log/error ::couldnt-fetch-category
|
||||
:exception e)
|
||||
"Uncategorized"))
|
||||
|
||||
(:item_data item)
|
||||
"Uncategorized"
|
||||
|
||||
Reference in New Issue
Block a user