catch exceptions hook, line, and sinker

add test for usage in macros

+13 -1
+13 -1
test/noahtheduke/sinker_test.clj
··· 73 73 (expect-it "to choose keyword over predicate" 74 74 (= ::pred (first (test-try #(throw (ex-info "" {:key :value 75 75 :var-key :var-value}))))))) 76 - (describe "") 77 76 (describe "malformed" 78 77 (expect-it "rejects catches with no body" 79 78 (causes-with-msg? ··· 105 104 clojure.lang.Compiler$CompilerException 106 105 #"Syntax error" 107 106 #(eval '(sut/try+ 1 (finally :foo) 2)))))) 107 + 108 + (defmacro example-macro 109 + [& body] 110 + `(sut/try+ ~@body 111 + (catch ::macro-exception data# 112 + data#))) 113 + 114 + (defdescribe macro-test 115 + (it "works with macro-expansion" 116 + (expect (= {:type ::macro-exception 117 + :flavor :grape} 118 + (example-macro (throw (ex-info "gotcha" {:type ::macro-exception 119 + :flavor :grape})))))))