From 8ffece69879080bd9d6f3853e0df44cb34b9ce73 Mon Sep 17 00:00:00 2001 From: Sergey Bronnikov Date: Wed, 9 Sep 2026 12:51:34 +0300 Subject: [PATCH] Report a proper error for an unknown model name The --model option was validated with `identity`, which always returns a truthy value for a non-empty string, so an invalid model name slipped through to `case` in check-history and blew up with a raw IllegalArgumentException ("No matching clause: ...") and a stack trace. The patch now validates the model name against the supported models map and exits with status 1 instead of dumping a stack trace. Fixes #100 --- CHANGELOG.md | 2 ++ src/elle_cli/cli.clj | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d57861f..75cff10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ change log follows the conventions of ### Changed +- Report a proper error for an unknown model name (#100). + ### Deprecated ### Fixed diff --git a/src/elle_cli/cli.clj b/src/elle_cli/cli.clj index 1a810de..ad01efe 100644 --- a/src/elle_cli/cli.clj +++ b/src/elle_cli/cli.clj @@ -93,9 +93,9 @@ "tools.cli options" ; General options. - [["-m" "--model MODEL" + [ ["-m" "--model MODEL" "(General) A name of consistency model for checking." - :validate [identity + :validate [#(contains? models %) (str "Must be one of " (str/join ", " (sort (keys models))))]] ["-f" "--format FORMAT" "(General) Format of file with history. Either 'edn' or 'json'."