Skip to content

Commit 84103a0

Browse files
committed
Make :compile-like a string instead
1 parent b3ee882 commit 84103a0

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## master (unreleased)
44

5-
## 0.3.0 (2023-09-29)
5+
## 0.3.1 (2023-09-29)
66

77
* `analyzer`: include a `:compile-like` key which indicates if the error happened at a "compile-like" phase.
88
* It represents exceptions that happen at runtime (and therefore never include a `:phase`) which however, represent code that cannot possibly work, and therefore are a "compile-like" exception (i.e. a linter could have caught them).

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ kondo:
3030
deploy: check-env
3131
lein with-profile -user,-dev,+$(VERSION) deploy clojars
3232

33-
# Usage: PROJECT_VERSION=0.3.0 make install
33+
# Usage: PROJECT_VERSION=0.3.1 make install
3434
# PROJECT_VERSION is needed because it's not computed dynamically.
3535
install: check-install-env
3636
lein with-profile -user,-dev,+$(VERSION) install

README.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ for writing Instaparse grammars:
252252
Here's how to deploy to Clojars:
253253

254254
#+begin_src sh
255-
git tag -a v0.3.0 -m "0.3.0"
255+
git tag -a v0.3.1 -m "0.3.1"
256256
git push --tags
257257
#+end_src
258258

src/haystack/analyzer.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@
368368
phase (-> cause-data :data :clojure.error/phase)
369369
m {:class (name (:type cause-data))
370370
:phase phase
371-
:compile-like (boolean (and (not phase)
372-
(compile-like-exception? cause-data)))
371+
:compile-like (pr-str (boolean (and (not phase)
372+
(compile-like-exception? cause-data))))
373373
:message (:message cause-data)
374374
:stacktrace (analyze-stacktrace-data
375375
(cond (seq (:trace cause-data))

test/haystack/analyzer_test.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -614,36 +614,36 @@
614614

615615
(testing "`:compile-like`"
616616
(testing "For non-existing fields"
617-
(is (= [true]
617+
(is (= ["true"]
618618
(->> (try
619619
(eval '(.-foo ""))
620620
(catch Throwable e
621621
(sut/analyze e)))
622622
(map :compile-like)))))
623623
(testing "For non-existing methods"
624-
(is (= [true]
624+
(is (= ["true"]
625625
(->> (try
626626
(eval '(-> "" (.foo 1 2)))
627627
(catch Throwable e
628628
(sut/analyze e)))
629629
(map :compile-like)))))
630630
(testing "For vanilla exceptions"
631-
(is (= [false]
631+
(is (= ["false"]
632632
(->> (try
633633
(throw (ex-info "." {}))
634634
(catch Throwable e
635635
(sut/analyze e)))
636636
(map :compile-like)))))
637637
(testing "For vanilla `IllegalArgumentException`s"
638-
(is (= [false]
638+
(is (= ["false"]
639639
(->> (try
640640
(throw (IllegalArgumentException. "foo"))
641641
(catch Throwable e
642642
(sut/analyze e)))
643643
(map :compile-like)))))
644644
(testing "For exceptions with a `:phase`"
645-
(is (#{[false false] ;; normal expectation
646-
[false]} ;; clojure 1.8
645+
(is (#{["false" "false"] ;; normal expectation
646+
["false"]} ;; clojure 1.8
647647
(->> (try
648648
(eval '(let [1]))
649649
(catch Throwable e

0 commit comments

Comments
 (0)