Skip to content

Instantly share code, notes, and snippets.

@bhb
Created October 18, 2017 22:49
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhb/ebce74eb04a24933b2fa4bec8f5b2922 to your computer and use it in GitHub Desktop.
Save bhb/ebce74eb04a24933b2fa4bec8f5b2922 to your computer and use it in GitHub Desktop.
Error messages at clojure repls
;; clojure 1.8.0 - lein repl
user=> (defn hello "hello world")
IllegalArgumentException Parameter declaration missing clojure.core/assert-valid-fdecl (core.clj:7181)
;; clojure 1.9.0-beta2 - lein repl
user=> (defn hello "hello world")
CompilerException clojure.lang.ExceptionInfo: Call to clojure.core/defn did not conform to spec:
val: () fails spec: :clojure.core.specs.alpha/defn-args at: [:args :bs] predicate: (alt :arity-1 :clojure.core.specs.alpha/args+body :arity-n (cat :bodies (+ (spec :clojure.core.specs.alpha/args+body)) :attr (? map?))), Insufficient input
#:clojure.spec.alpha{:problems [{:path [:args :bs], :reason "Insufficient input", :pred (clojure.spec.alpha/alt :arity-1 :clojure.core.specs.alpha/args+body :arity-n (clojure.spec.alpha/cat :bodies (clojure.spec.alpha/+ (clojure.spec.alpha/spec :clojure.core.specs.alpha/args+body)) :attr (clojure.spec.alpha/? clojure.core/map?))), :val (), :via [:clojure.core.specs.alpha/defn-args], :in []}], :spec #object[clojure.spec.alpha$regex_spec_impl$reify__1188 0x58b7f643 "clojure.spec.alpha$regex_spec_impl$reify__1188@58b7f643"], :value (hello "hello world"), :args (hello "hello world")}, compiling:(/private/var/folders/yp/4t8hgrbs48s7_knny7sxjsxm0000gn/T/form-init9033224319960604811.clj:1:1)
;; with expound
user=> (require '[expound.alpha :as expound])
nil
user=> (require '[clojure.spec.alpha :as s])
nil
user=> (set! s/*explain-out* expound/printer)
#function[expound.alpha/printer]
user=> (defn hello "hello world")
CompilerException clojure.lang.ExceptionInfo: Call to clojure.core/defn did not conform to spec:
-- Syntax error -------------------
(hello "hello world")
should have additional elements. The next element is named `:args` and satisfies
(clojure.spec.alpha/alt
:arity-1
:clojure.core.specs.alpha/args+body
:arity-n
(clojure.spec.alpha/cat
:bodies
(clojure.spec.alpha/+
(clojure.spec.alpha/spec :clojure.core.specs.alpha/args+body))
:attr
(clojure.spec.alpha/? map?)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment