2024 Clojure状态调查中分享您的想法!

欢迎!请您参考关于页面了解有关如何使用本服务的更多信息。

0
Spec

异常源自此行
https://github.com/clojure/clojure/blob/clojure-1.9.0/src/jvm/clojure/lang/ExceptionInfo.java#L31

由于此调用
https://github.com/clojure/spec.alpha/blob/spec.alpha-0.1.143/src/main/clojure/clojure/spec/test/alpha.clj#L279

如果`when-not`返回nil,`ExceptionInfo`将在第31行抛出异常。

一个简单的修复可能为
(apply ex-info (remove nil? (link: "基于指定的检查失败" (when-not ...))))

但这实际上只是掩盖了问题,并没有给失败者提供任何可操作的信息。

遗憾的是,我没有最小测试用例,因为这属于专有(且复杂)代码。

也许作者在阅读代码后会有更多的见解。

以下是完整的堆栈跟踪

(链接:[clojure.lang.ExceptionInfo "ExceptionInfo.java" 31] (链接:clojure.lang.ExceptionInfo "ExceptionInfo.java" 22) (链接:clojure.core$ex_info invokeStatic "core.clj" 4739) (链接:clojure.core$ex_info invoke "core.clj" 4739) (链接:clojure.spec.test.alpha$explain_check invokeStatic "alpha.clj" 277) (链接:clojure.spec.test.alpha$explain_check invoke "alpha.clj" 275) (链接:clojure.spec.test.alpha$check_call invokeStatic "alpha.clj" 295) (链接:clojure.spec.test.alpha$check_call invoke "alpha.clj" 285) (链接:clojure.spec.test.alpha$quick_check$fn__2986 invoke "alpha.clj" 308) (链接:clojure.lang.AFn applyToHelper "AFn.java" 154) (链接:clojure.lang.AFn applyTo "AFn.java" 144) (链接:clojure.core$apply invokeStatic "core.clj" 657) (链接:clojure.core$apply invoke "core.clj" 652) (链接:clojure.test.check.properties$apply_gen$fn__16139$fn__16140 invoke "properties.cljc" 30) (链接:clojure.test.check.properties$apply_gen$fn__16139 invoke "properties.cljc" 29) (链接:clojure.test.check.rose_tree$fmap invokeStatic "rose_tree.cljc" 77) (链接:clojure.test.check.rose_tree$fmap invoke "rose_tree.cljc" 73) (链接:clojure.test.check.generators$fmap$fn__9199 invoke "generators.cljc" 101) (链接:clojure.test.check.generators$gen_fmap$fn__9173 invoke "generators.cljc" 57) (链接:clojure.test.check.generators$call_gen invokeStatic "generators.cljc" 41) (链接:clojure.test.check.generators$call_gen invoke "generators.cljc" 37) (链接:clojure.test.check$quick_check invokeStatic "check.cljc" 94) (链接:clojure.test.check$quick_check doInvoke "check.cljc" 37) (链接:clojure.lang.RestFn invoke "RestFn.java" 425) (链接:clojure.lang.AFn applyToHelper "AFn.java" 156) (链接:clojure.lang.RestFn applyTo "RestFn.java" 132) (链接:clojure.core$apply invokeStatic "core.clj" 657) (链接:clojure.core$apply invoke "core.clj" 652) (链接:clojure.spec.gen.alpha$quick_check invokeStatic "alpha.clj" 29) (链接:clojure.spec.gen.alpha$quick_check doInvoke "alpha.clj" 27) (链接:clojure.lang.RestFn applyTo "RestFn.java" 137) (链接:clojure.core$apply invokeStatic "core.clj" 661) (链接:clojure.core$apply invoke "core.clj" 652) (链接:clojure.spec.test.alpha$quick_check invokeStatic "alpha.clj" 309) (链接:clojure.spec.test.alpha$quick_check invoke "alpha.clj" 302) (链接:clojure.spec.test.alpha$check_1 invokeStatic "alpha.clj" 335) (链接:clojure.spec.test.alpha$check_1 invoke "alpha.clj" 323) (链接:clojure.spec.test.alpha$check$fn__3005 invoke "alpha.clj" 411) (链接:clojure.core$pmap$fn__8105$fn__8106 invoke "core.clj" 6942) (链接:clojure.core$binding_conveyor_fn$fn__5476 invoke "core.clj" 2022) (链接:clojure.lang.AFn call "AFn.java" 18) (链接:java.util.concurrent.FutureTask run "FutureTask.java" 266) (链接:java.util.concurrent.ThreadPoolExecutor runWorker "ThreadPoolExecutor.java" 1149) (链接:java.util.concurrent.ThreadPoolExecutor$Worker run "ThreadPoolExecutor.java" 624) (链接:java.lang.Thread run "Thread.java" 748)

16 个答案

0
by
参考:[https://clojure.atlassian.net/browse/CLJ-2304](https://clojure.atlassian.net/browse/CLJ-2304) (由johanatan报告)
...