From b361d7c42db1729d3a11209f6a2aa272006b5cac Mon Sep 17 00:00:00 2001 From: Cam Saul Date: Sun, 1 Jan 2023 03:48:33 +0000 Subject: [PATCH] Improved 'no matching method' error messages. --- src/methodical/impl/standard.clj | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/methodical/impl/standard.clj b/src/methodical/impl/standard.clj index 924efd8..b0b020b 100644 --- a/src/methodical/impl/standard.clj +++ b/src/methodical/impl/standard.clj @@ -19,10 +19,12 @@ (defn- handle-effective-method-exception [^Exception e mta] (if-let [dispatch-val (::unmatched-dispatch-value (ex-data e))] (throw (UnsupportedOperationException. - (format "No matching%s method for dispatch value %s" (if-let [nm (:name mta)] - (str " " nm) - "") - (pr-str dispatch-val)))) + (format "No matching%s method for dispatch value %s" (if-let [nm (if (:ns mta) + (str (:ns mta) "/" (:name mta)) + (:name mta))] + (str " " nm) + "") + (pr-str dispatch-val)))) ;; this wasn't an :unmatched-dispatch-value situation; just rethrow it (throw e)))