Comments (9)
Good catch! I've added a new check for warnings to the CI script and fixed this warning. I've pushed a new version of 0.7.2-SNAPSHOT
with the fix.
from expound.
Related: #102
from expound.
Workaround:
(require '[expound.alpha :as expound])
(defn safe-printer [explain-data]
(let [exp (expound/custom-printer {})]
(try
(exp explain-data)
(catch Exception e e
(s/explain-printer explain-data)))))
(set! s/*explain-out* safe-printer)
(s/def ::sorted-pair (s/and (s/cat :x int? :y int?) #(< (-> % :x) (-> % :y))))
;; Usually use expound
(s/explain int? "a")
;;-- Spec failed --------------------
;;
;; "a"
;;
;;should satisfy
;;
;; int?
;;
;;-------------------------
;;Detected 1 error
;; If there is an issue, fallback on s/explain-printer
(s/explain ::sorted-pair [0 0])
;; val: {:x 0, :y 0} fails spec: :expound.alpha/sorted-pair predicate: (< (-> % :x) (-> % :y))
from expound.
I have run into this and thanks for the workaround!
from expound.
@arichiardi @borkdude I've got a fix for this issue in 0.7.2-SNAPSHOT. If you have time to try it out, please let me know what you think!
from expound.
First feedback, with shadow-cljs
I receive these warnings:
------ WARNING #1 --------------------------------------------------------------
File: expound/problems.cljc:110:47
--------------------------------------------------------------------------------
107 | :clj java.lang.Exception) _e
108 | nil)
109 | (catch #?(:cljs :default
110 | :clj java.lang.Error) _e
-----------------------------------------------------^--------------------------
Use of undeclared Var expound.problems/_e
--------------------------------------------------------------------------------
111 | nil))
112 |
113 | new-in (cond in1
114 | in1
--------------------------------------------------------------------------------
from expound.
@bhb Is this also available in master?
I've tried http://bit.ly/speculative-repl with
(stest/instrument `subs)
(try
;; insert your call here
(subs "foo" 5)
(catch :default e
(println (.-message e))
(throw e)))
and I'm seeing:
Cannot convert path. This can be caused by using conformers to transform values, which is not supported in Expound
from expound.
This is currently only on the “next” branch. I’m hoping to get a release out this month, which will move this to master.
from expound.
Fixed in 0.7.2-SNAPSHOT (to be released soon)
from expound.
Related Issues (20)
- Error reports returned as :cause string in an exception when produced by instrumentation within generative testing HOT 11
- allow passing options map to expound/expound-str HOT 1
- Improve grouping of spec errors HOT 2
- Unnecessary dependency on `cider-nrepl` HOT 1
- Regression of #3 HOT 4
- Easier editing of error messages
- `printer` has invalid spec HOT 2
- "Cannot convert path" on instrumentation failures in the wild HOT 4
- (cljs.spec.test.alpha/instrument) breaks expound due to wrong arity HOT 4
- should expound work anywhere s/explain works? - clojurescript error HOT 7
- Error in :ret check when using with Orchestra 2020.07.12-1 HOT 5
- Internal error in `lift-singleton-groups` when having a datomic db value in fn args HOT 13
- Crash bug when printing, if a datomic db is present and the spec fails HOT 19
- Feature inquiry: a convenience function for validating a value against a spec HOT 4
- Wrapped `s/keys` does not properly display unqualified keyword specs HOT 5
- ClassCastException from `expound-str` when running in AWS Lambda HOT 9
- Small *print-length* and/or *print-level* sometimes yield NPE HOT 5
- PersistentList cannot be cast to class Named HOT 3
- proposal : defmsg equivalent for arbitrary predicates HOT 15
- optional include location of the spec error in the message. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expound.