Skip to content

Commit

Permalink
Merge pull request #901 from fluree/docs/add-note-about-humanize-exce…
Browse files Browse the repository at this point in the history
…ptions

Add a note to the README about humanizing exceptions
  • Loading branch information
ikitommi authored Aug 8, 2023
2 parents d72ab6c + 310ff1c commit df3ad51
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,17 @@ Explain results can be humanized with `malli.error/humanize`:
; :lonlat [nil ["should be a double"]]}}
```

Or if you already have a malli validation exception (e.g. in a catch form):

```clojure
(require '[malli.error :as me])

(try
(m/validate Address {:not "an address"})
(catch Exception e
(-> e ex-data :data :explain me/humanize)))
```

## Custom error messages

Error messages can be customized with `:error/message` and `:error/fn` properties:
Expand Down

0 comments on commit df3ad51

Please sign in to comment.