clojure icon indicating copy to clipboard operation
clojure copied to clipboard

Human readable Spec messages

Open practicalli-johnny opened this issue 5 years ago • 0 comments

TODOL create a section on understanding spec error messages

A section on improving spec error message Expound formats clojure.spec error messages in a way that is optimized for humans to read.

https://github.com/bhb/expound

For example, Expound will replace a clojure.spec error message like:

val: {} fails spec: :example/place predicate: (contains? % :city)
val: {} fails spec: :example/place predicate: (contains? % :state)

with

-- Spec failed --------------------
  {}
should contain keys: :city, :state

| key    | spec    |
|========+=========|
| :city  | string? |
|--------+---------|
| :state | string? |

practicalli-johnny avatar Nov 18 '20 14:11 practicalli-johnny