Skip to content

Commit 22e41e1

Browse files
committed
fix(jepsen-zset): guard nil .getMessage on exception :error fields
Throwable.getMessage() can return nil when the exception was constructed without a detail message. Without a guard, the op would record :error nil -- an unhelpful signal that hides the real failure mode. Wrap every .getMessage call feeding :error (or an error string) with (or (.getMessage t) (str t)) so the diagnostic falls back to the exception's class + inner state when no message is attached. Applies to three sites in redis_zset_safety_workload.clj: - coerce-zincrby-score's Throwable branch - setup! cleanup-failed ex-info message - invoke!'s catch-all :info error recorder
1 parent 623d5c2 commit 22e41e1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

jepsen/src/elastickv/redis_zset_safety_workload.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
;; Carmine surfaces Redis error replies as exceptions by default,
117117
;; but some codepaths wrap them in an ex-info / Throwable value.
118118
(instance? Throwable response)
119-
[:error (.getMessage ^Throwable response)]
119+
[:error (or (.getMessage ^Throwable response) (str response))]
120120

121121
:else
122122
[:unexpected response]))
@@ -184,7 +184,7 @@
184184
(warn t "ZSet safety setup! DEL failed -- aborting to avoid stale data")
185185
(throw (ex-info
186186
(str "ZSet safety setup! failed to clear prior state at "
187-
zset-key ": " (.getMessage t)
187+
zset-key ": " (or (.getMessage t) (str t))
188188
". Refusing to run against potentially stale data.")
189189
{:type ::cleanup-failed
190190
:zset-key zset-key}
@@ -245,7 +245,7 @@
245245
:members (parse-withscores flat)})))
246246
(catch Exception e
247247
(warn e (str "ZSet safety op failed: " (:f op)))
248-
(assoc op :type :info :error (.getMessage e)))))))
248+
(assoc op :type :info :error (or (.getMessage e) (str e))))))))
249249

250250
;; ---------------------------------------------------------------------------
251251
;; Generator

0 commit comments

Comments
 (0)