This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-09
Channels
- # announcements (2)
- # babashka (33)
- # beginners (122)
- # bristol-clojurians (1)
- # calva (6)
- # chlorine-clover (3)
- # cider (45)
- # clara (10)
- # clj-kondo (3)
- # cljsrn (17)
- # clojure (80)
- # clojure-dev (21)
- # clojure-europe (86)
- # clojure-italy (5)
- # clojure-japan (5)
- # clojure-losangeles (7)
- # clojure-nl (5)
- # clojure-portugal (3)
- # clojure-uk (31)
- # clojurescript (30)
- # conjure (4)
- # core-async (29)
- # cursive (20)
- # data-science (25)
- # datomic (7)
- # duct (17)
- # figwheel-main (73)
- # fulcro (23)
- # jobs-discuss (36)
- # juxt (5)
- # kaocha (2)
- # lambdaisland (6)
- # luminus (5)
- # malli (17)
- # mount (10)
- # music (7)
- # off-topic (16)
- # re-frame (30)
- # ring (17)
- # rum (1)
- # shadow-cljs (10)
- # spacemacs (10)
- # specmonstah (4)
- # sql (45)
- # tools-deps (21)
- # xtdb (20)
would there be any interest in a patch to add an assert that allowed for data in an ex-info
rather than just a message string?
(assert (every? symbol? gs) (str "Invalid predicate expression " gs))
from core match.
vs
(assert (every? symbol? gs) {:pattern p :predicate-expression gs})
no. but asserts used for constraint violations are convenient and feel right. But when the constraint is violated you can only give a string message rather than the richer data structure that ex-info
allows
I'm guessing that there is some stringy exception somewhere that you want to have richer data?
used that for a public example. in our codebase, we assert colls/only
, that a collection only had a single value. like the results of a query that you expect to return a single value. Would be nice if we could include the clause that violated the constraint in our message rather than just pr-str'ing it
An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch
so having a payload doesn't seem that worthy if you're not supposed to be able to access it