Git Product home page Git Product logo

Comments (9)

bhb avatar bhb commented on August 24, 2024 1

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.

bhb avatar bhb commented on August 24, 2024

Related: #102

from expound.

bhb avatar bhb commented on August 24, 2024

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.

arichiardi avatar arichiardi commented on August 24, 2024

I have run into this and thanks for the workaround!

from expound.

bhb avatar bhb commented on August 24, 2024

@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.

arichiardi avatar arichiardi commented on August 24, 2024

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.

borkdude avatar borkdude commented on August 24, 2024

@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.

bhb avatar bhb commented on August 24, 2024

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.

bhb avatar bhb commented on August 24, 2024

Fixed in 0.7.2-SNAPSHOT (to be released soon)

from expound.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.