File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 177
177
[spec x]
178
178
(explain-data* spec [] (if-let [name (spec-name spec)] [name] []) [] x))
179
179
180
- (defn explain-out
181
- " prints an explanation to *out* ."
180
+ (defn explain-printer
181
+ " Default printer for explain-data. nil indicates a successful validation ."
182
182
[ed]
183
183
(if ed
184
184
(print
209
209
(newline )))))
210
210
(println " Success!" )))
211
211
212
+ (def ^:dynamic *explain-out* explain-printer )
213
+
214
+ (defn explain-out
215
+ " Prints explanation data (per 'explain-data') to *out* using the printer in *explain-out*,
216
+ by default explain-printer."
217
+ [ed]
218
+ (*explain-out* ed))
219
+
212
220
(defn explain
213
221
" Given a spec and a value that fails to conform, prints an explanation to *out*."
214
222
[spec x]
You can’t perform that action at this time.
0 commit comments