From 6ab490b3e95c3adea88a72673f880624fe94803a Mon Sep 17 00:00:00 2001 From: ec027900 Date: Tue, 19 Jul 2022 15:58:59 -0500 Subject: [PATCH 1/4] #264:Provide better exception when unable to resolve class while deserializing rulebase --- src/main/clojure/clara/rules/durability/fressian.clj | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/clojure/clara/rules/durability/fressian.clj b/src/main/clojure/clara/rules/durability/fressian.clj index a7f40c49..e1605596 100644 --- a/src/main/clojure/clara/rules/durability/fressian.clj +++ b/src/main/clojure/clara/rules/durability/fressian.clj @@ -132,7 +132,11 @@ ([^Reader rdr] (read-record rdr nil)) ([^Reader rdr add-fn] - (let [builder (-> (.readObject rdr) resolve deref) + (let [try-resolve #(if-let [clazz (resolve %)] + clazz + (throw (ex-info (str "Unable to resolve record symbol: '" % "'") + {:record-class %}))) + builder (-> (.readObject rdr) try-resolve deref) build-map (.readObject rdr) m (read-meta rdr)] (cond-> (builder build-map) From afb0604adaaf57219ba4c87dbdc9b40a150f5449 Mon Sep 17 00:00:00 2001 From: Ethan Christian Date: Thu, 21 Jul 2022 08:00:00 -0500 Subject: [PATCH 2/4] record -> fact type Co-authored-by: Mike Rodriguez --- src/main/clojure/clara/rules/durability/fressian.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clojure/clara/rules/durability/fressian.clj b/src/main/clojure/clara/rules/durability/fressian.clj index e1605596..d99e84fa 100644 --- a/src/main/clojure/clara/rules/durability/fressian.clj +++ b/src/main/clojure/clara/rules/durability/fressian.clj @@ -134,7 +134,7 @@ ([^Reader rdr add-fn] (let [try-resolve #(if-let [clazz (resolve %)] clazz - (throw (ex-info (str "Unable to resolve record symbol: '" % "'") + (throw (ex-info (str "Unable to resolve fact type symbol: '" % "'") {:record-class %}))) builder (-> (.readObject rdr) try-resolve deref) build-map (.readObject rdr) From cff17c5784a097ad6a713b16205c61146abf3ac4 Mon Sep 17 00:00:00 2001 From: Ethan Christian Date: Thu, 21 Jul 2022 08:00:18 -0500 Subject: [PATCH 3/4] record -> fact type Co-authored-by: Mike Rodriguez --- src/main/clojure/clara/rules/durability/fressian.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clojure/clara/rules/durability/fressian.clj b/src/main/clojure/clara/rules/durability/fressian.clj index d99e84fa..18f9d437 100644 --- a/src/main/clojure/clara/rules/durability/fressian.clj +++ b/src/main/clojure/clara/rules/durability/fressian.clj @@ -135,7 +135,7 @@ (let [try-resolve #(if-let [clazz (resolve %)] clazz (throw (ex-info (str "Unable to resolve fact type symbol: '" % "'") - {:record-class %}))) + {:fact-type-class %}))) builder (-> (.readObject rdr) try-resolve deref) build-map (.readObject rdr) m (read-meta rdr)] From 5252ca54994b2a521897bce2a6d8a2af5b223edf Mon Sep 17 00:00:00 2001 From: Ethan Christian Date: Thu, 10 Nov 2022 23:15:08 -0600 Subject: [PATCH 4/4] Correct terminology around class --- src/main/clojure/clara/rules/durability/fressian.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/clojure/clara/rules/durability/fressian.clj b/src/main/clojure/clara/rules/durability/fressian.clj index 18f9d437..5d91e94d 100644 --- a/src/main/clojure/clara/rules/durability/fressian.clj +++ b/src/main/clojure/clara/rules/durability/fressian.clj @@ -132,10 +132,10 @@ ([^Reader rdr] (read-record rdr nil)) ([^Reader rdr add-fn] - (let [try-resolve #(if-let [clazz (resolve %)] - clazz + (let [try-resolve #(if-let [resolved (resolve %)] + resolved (throw (ex-info (str "Unable to resolve fact type symbol: '" % "'") - {:fact-type-class %}))) + {:unresolvable-symbol %}))) builder (-> (.readObject rdr) try-resolve deref) build-map (.readObject rdr) m (read-meta rdr)]