enhance: better error report when parsing

This commit is contained in:
Tienson Qin
2021-08-30 23:36:15 +08:00
parent b63aa2c03c
commit 422c2de99d
3 changed files with 30 additions and 23 deletions

View File

@@ -231,17 +231,19 @@
(defn ->edn
[content config]
(try
(if (string/blank? content)
[]
(-> content
(parse-json config)
(util/json->clj)
(update-src-full-content content)
(collect-page-properties)))
(catch js/Error e
(log/error :edn/convert-failed e)
[])))
(if (string? content)
(try
(if (string/blank? content)
[]
(-> content
(parse-json config)
(util/json->clj)
(update-src-full-content content)
(collect-page-properties)))
(catch js/Error e
(log/error :edn/convert-failed e)
[]))
(log/error :edn/wrong-content-type content)))
(defn ->edn-async
[content config]