Skip to content

Commit

Permalink
checker/check-safe: write errors to results.edn using datafy, not a h…
Browse files Browse the repository at this point in the history
…orrible string.
  • Loading branch information
aphyr committed Oct 17, 2024
1 parent 0d15725 commit 379b241
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jepsen/src/jepsen/checker.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"Validates that a history is correct with respect to some model."
(:refer-clojure :exclude [set])
(:require [clojure [core :as c]
[datafy :refer [datafy]]
[pprint :refer [pprint]]
[set :as set]
[stacktrace :as trace]
Expand Down Expand Up @@ -79,15 +80,16 @@
(defn check-safe
"Like check, but wraps exceptions up and returns them as a map like
{:valid? :unknown :error \"...\"}"
{:valid? :unknown
:error {:via [{:type clojure.lang.Exceptioninfo, ...}] ...}"
([checker test history]
(check-safe checker test history {}))
([checker test history opts]
(try (check checker test history opts)
(catch Exception t
(warn t "Error while checking history:")
{:valid? :unknown
:error (with-out-str (trace/print-cause-trace t))}))))
:error (datafy t)}))))

(defn compose
"Takes a map of names to checkers, and returns a checker which runs each
Expand Down

0 comments on commit 379b241

Please sign in to comment.