144144
145145 Takes the same options as pinpoint."
146146 ([ed] (pinpoint-out ed {}))
147- ([ed {:keys [width colorize fallback-on-error eval] :as opts
148- :or {width 70 , fallback-on-error true }}]
147+ ([ed {:keys [width colorize eval fallback-on-error fallback-reporting-fn] :as opts
148+ :or {width 70
149+ fallback-on-error true
150+ fallback-reporting-fn (fn [_]
151+ (println (str " [PINPOINTER] Failed to analyze the spec errors, "
152+ " and will fall back to s/explain-printer\n " )))}}]
149153 (if ed
150154 (let [{:keys [::s/problems ::s/value ] :as ed'} (correct-paths ed)
151155 nproblems (count problems)
171175 " :" (:line caller) " )" )))))
172176
173177 fallback-on-error
174- (do (println " [PINPOINTER] Failed to analyze the spec errors, and will fall back to s/explain-printer\n " )
178+ (do (fallback-reporting-fn {:explain-data ed
179+ :exception traces})
175180 (s/explain-printer ed))
176181
177182 :else (throw traces)))
@@ -190,6 +195,9 @@ The opts map may have the following keys:
190195 :fallback-on-error - If set to true, falls back to
191196 s/explain-printer in case of an error during the analysis.
192197 Otherwise, rethrows the error. Defaults to true.
198+ :fallback-reporting-fn - A fn (which takes as an argument a map with `:explanation-data` and `:exception` keys)
199+ which reports that pinpointer is falling back to clojure.spec
200+ to reports error. Defaults to a println with a fixed message.
193201 :eval - eval fn to be used to analyze spec errors. Defaults to
194202 clojure.core/eval in Clojure, nil in ClojureScript."
195203 ([spec x] (pinpoint spec x {}))
0 commit comments