-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reporter/report-error: allow reporting a message with extra data (#69)
It seems that since [this change](c3fa4f4#diff-1d086718b79e44223815f06018dd5b132dbd6a516a4437241c8a76a3aedcd7dcL83-R85) we lost the ability to provide a message plus some extra data. Allowed the fn to accept the `:extra` params along the hash map with the `:message` field.
- Loading branch information
Showing
2 changed files
with
29 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(ns spootnik.reporter.reporter-test | ||
(:require | ||
[clojure.test :refer [deftest is testing]] | ||
[spootnik.reporter :as sut])) | ||
|
||
(deftest report-error-test | ||
(with-redefs [sut/capture! identity] | ||
(testing "with message" | ||
(is (= {:message "error message" :extra {:foo "bar"}} | ||
(sut/report-error {:message "error message"} | ||
{:foo "bar"})))) | ||
|
||
(testing "with exception" | ||
(let [e (ex-info "Exception" {:some :more-data} | ||
(ex-info "Root exception" {:some :data}))] | ||
(is (= {:throwable e :extra {:foo "bar"}} | ||
(sut/report-error e | ||
{:foo "bar"}))))))) | ||
|