Closed armed closed 11 months ago
Here is a minimal example:
(ns main (:require [malli.dev :as md])) (defn my-func ;; invalid schema {:malli/schema [:=> [:cat [:vector] :any]]} [] "hello") (comment ;; throws ex (md/start!))
The thrown exception does not contain information about real source of exception (at least function name and namespace where it appeared), which drives to long debug sessions when fn-schemas are scattered between dependencies.
#error { :cause ":malli.core/child-error" :data {:type :malli.core/child-error, :message :malli.core/child-error, :data {:type :=>, :properties nil, :children [[:cat [:vector] :any]], :min 2, :max 2}} :via [{:type clojure.lang.ExceptionInfo :message ":malli.core/child-error" :data {:type :malli.core/child-error, :message :malli.core/child-error, :data {:type :=>, :properties nil, :children [[:cat [:vector] :any]], :min 2, :max 2}} :at [malli.core$_exception invokeStatic "core.cljc" 138]}] :trace [[malli.core$_exception invokeStatic "core.cljc" 138] [malli.core$_exception invoke "core.cljc" 136] [malli.core$_fail_BANG_ invokeStatic "core.cljc" 142] [malli.core$_fail_BANG_ invoke "core.cljc" 140] [malli.core$_check_children_BANG_ invokeStatic "core.cljc" 168] [malli.core$_check_children_BANG_ invoke "core.cljc" 160] [malli.core$__EQ__GT$reify__17397 _into_schema "core.cljc" 1716] [malli.core$into_schema invokeStatic "core.cljc" 1943] [malli.core$into_schema invoke "core.cljc" 1934] [malli.core$schema invokeStatic "core.cljc" 2004] [malli.core$schema invoke "core.cljc" 1985] [malli.core$function_schema invokeStatic "core.cljc" 2461] [malli.core$function_schema invoke "core.cljc" 2458] [malli.core$function_schema invokeStatic "core.cljc" 2459] [malli.core$function_schema invoke "core.cljc" 2458] [malli.core$_register_function_schema_BANG_ invokeStatic "core.cljc" 2469] [malli.core$_register_function_schema_BANG_ invoke "core.cljc" 2466] [malli.core$_register_function_schema_BANG_ invokeStatic "core.cljc" 2467] [malli.core$_register_function_schema_BANG_ invoke "core.cljc" 2466] [malli.instrument$_collect_BANG_ invokeStatic "instrument.clj" 43] [malli.instrument$_collect_BANG_ invoke "instrument.clj" 41] [malli.instrument$clj_collect_BANG_$fn__19972 invoke "instrument.clj" 48] [clojure.core.protocols$iter_reduce invokeStatic "protocols.clj" 49] [clojure.core.protocols$fn__8238 invokeStatic "protocols.clj" 75] [clojure.core.protocols$fn__8238 invoke "protocols.clj" 75] [clojure.core.protocols$fn__8178$G__8173__8191 invoke "protocols.clj" 13] [clojure.core$reduce invokeStatic "core.clj" 6886] [clojure.core$reduce invoke "core.clj" 6868] [malli.instrument$clj_collect_BANG_ invokeStatic "instrument.clj" 48] [malli.instrument$clj_collect_BANG_ invoke "instrument.clj" 45] [malli.dev$start_BANG_ invokeStatic "dev.clj" 23] [malli.dev$start_BANG_ invoke "dev.clj" 15] [malli.dev$start_BANG_ invokeStatic "dev.clj" 20] [malli.dev$start_BANG_ invoke "dev.clj" 15] [main$eval20065 invokeStatic "NO_SOURCE_FILE" 5] [main$eval20065 invoke "NO_SOURCE_FILE" 5] [clojure.lang.Compiler eval "Compiler.java" 7194] [clojure.lang.Compiler eval "Compiler.java" 7149] [clojure.core$eval invokeStatic "core.clj" 3215] [clojure.core$eval invoke "core.clj" 3211] [nrepl.middleware.interruptible_eval$evaluate$fn__3794$fn__3795 invoke "interruptible_eval.clj" 87] [clojure.lang.AFn applyToHelper "AFn.java" 152] [clojure.lang.AFn applyTo "AFn.java" 144] [clojure.core$apply invokeStatic "core.clj" 667] [clojure.core$apply invoke "core.clj" 662] [clojure.core$with_bindings_STAR_ invokeStatic "core.clj" 1999] [clojure.core$with_bindings_STAR_ doInvoke "core.clj" 1990] [clojure.lang.RestFn invoke "RestFn.java" 425] [nrepl.middleware.interruptible_eval$evaluate$fn__3794 invoke "interruptible_eval.clj" 87] [clojure.main$repl$read_eval_print__9206$fn__9209 invoke "main.clj" 437] [clojure.main$repl$read_eval_print__9206 invoke "main.clj" 437] [clojure.main$repl$fn__9215 invoke "main.clj" 458] [clojure.main$repl invokeStatic "main.clj" 458] [clojure.main$repl doInvoke "main.clj" 368] [clojure.lang.RestFn invoke "RestFn.java" 1523] [nrepl.middleware.interruptible_eval$evaluate invokeStatic "interruptible_eval.clj" 84] [nrepl.middleware.interruptible_eval$evaluate invoke "interruptible_eval.clj" 56] [nrepl.middleware.interruptible_eval$interruptible_eval$fn__3827$fn__3831 invoke "interruptible_eval.clj" 152] [clojure.lang.AFn run "AFn.java" 22] [nrepl.middleware.session$session_exec$main_loop__3897$fn__3901 invoke "session.clj" 218] [nrepl.middleware.session$session_exec$main_loop__3897 invoke "session.clj" 217] [clojure.lang.AFn run "AFn.java" 22] [java.lang.Thread run "Thread.java" 833]]}
Here is a minimal example:
The thrown exception does not contain information about real source of exception (at least function name and namespace where it appeared), which drives to long debug sessions when fn-schemas are scattered between dependencies.