https://github.com/onyx-platform/empathy
[Work in progress] Sometimes things go wrong. We understand.
https://github.com/onyx-platform/empathy
Last synced: 10 months ago
JSON representation
[Work in progress] Sometimes things go wrong. We understand.
- Host: GitHub
- URL: https://github.com/onyx-platform/empathy
- Owner: onyx-platform
- License: epl-1.0
- Archived: true
- Created: 2016-05-25T05:09:21.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-25T05:09:38.000Z (over 9 years ago)
- Last Synced: 2024-07-31T18:17:27.766Z (over 1 year ago)
- Language: Clojure
- Homepage:
- Size: 6.84 KB
- Stars: 15
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# empathy
Pretty printed errors built over clojure.spec
## Usage
Install locally from source. We're not up on Clojars yet.
There is one API function:
```clojure
(empathy.api/pretty-error! spec val)
```
`spec` is a clojure.spec specification. `val` is a value that presumably
does not conform to `spec`. `pretty-error!` will print out a human-friendly,
colored error message.
You can also extend predicate errors for custom error messages:
```clojure
(defmethod empathy.api/classify-error 'double?
[pred x]
{:type :type-error
:expected (.getName java.lang.Double)
:actual (.getName (.getClass x))
:summary "a double"})
```
`:summary` inlines an English explanation into a possibly chained
series of summaries describing the problem.
## License
Copyright © 2016 Distributed Masonry
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.