File tree Expand file tree Collapse file tree 5 files changed +46
-16
lines changed Expand file tree Collapse file tree 5 files changed +46
-16
lines changed Original file line number Diff line number Diff line change 11= sentry-tiny
22
33A Clojure library designed to cover basic needs of pushing exceptions into Sentry.
4- Not more, but not less
4+ We should prize every moment, isn't it?
55
66image:https://img.shields.io/clojars/v/net.tbt-post/sentry-tiny.svg[]
77
@@ -11,9 +11,37 @@ Add the following to your http://github.com/technomancy/leiningen[Leiningen's] `
1111
1212[source,clojure]
1313----
14- [net.tbt-post/sentry-tiny "0.1.5 "]
14+ [net.tbt-post/sentry-tiny "0.1.6 "]
1515----
1616
17+ and just use it to catch your exception:
18+
19+ [source,clojure]
20+ ----
21+ (require '[sentry-tiny.core :as stc])
22+
23+ (def dsn "http://<digest>@<sentry>/<id>")
24+
25+ (defn catch [ns _ _ ^Throwable e]
26+ (-> dsn
27+ stc/parse-dsn
28+ (stc/capture (stc/e->evi [(str ns)] e))))
29+ ----
30+
31+ or to just send a message
32+
33+ [source,clojure]
34+ ----
35+ (defn message [msg]
36+ (-> dsn
37+ stc/parse-dsn
38+ (stc/capture
39+ (stc/e->evi [(str *ns*)]
40+ (RuntimeException. msg)))))
41+ ----
42+
43+ You may eventually use it as a replacement inside of your web app router.
44+
1745== Manual Build
1846
1947[source,text]
Original file line number Diff line number Diff line change 1+ {:dev {:plugins [[lein-ancient " 0.6.15" ]]
2+ :deploy-repositories [[" private-jars" " http://10.10.3.4:9180/repo" ]]}
3+ :provided {:dependencies [[org.clojure/clojure " 1.9.0" ]]}
4+ :uberjar {:aot :all :jvm-opts #=(eval
5+ (concat [" -Xmx1G" ]
6+ (let [version (System/getProperty " java.version" )
7+ [major _ _] (clojure.string/split version #"\. " )]
8+ (if (>= (Integer. major) 9 )
9+ [" --add-modules" " java.xml.bind" ]
10+ []))))}}
Original file line number Diff line number Diff line change 33 :url " https://github.com/source-c/sentry-tiny"
44 :license {:name " Eclipse Public License"
55 :url " http://www.eclipse.org/legal/epl-v10.html" }
6- :dependencies [[org.clojure/clojure " 1.9.0" ]
7- [cheshire " 5.8.0" ]
6+ :dependencies [[cheshire " 5.8.0" ]
87 [http-kit " 2.2.0" ]
9- [clj-time " 0.14.2" ]
10- [danlentz/clj-uuid " 0.1.7" ]]
11- :plugins [[lein-ancient " 0.6.15" ]]
12- :profiles {:uberjar {:aot :all :jvm-opts ~(let [version (System/getProperty " java.version" )
13- [major _ _] (clojure.string/split version #"\. " )]
14- (if (>= (Integer. major) 9 ) ; ; FIXME: drop this tricky hack/hacky trick
15- [" --add-modules" " java.xml.bind" ]
16- []))}})
8+ [clj-time " 0.14.2" ]])
Original file line number Diff line number Diff line change 1- 0.1.5
1+ 0.1.6
Original file line number Diff line number Diff line change 44 [clojure.java.io :as io]
55 [org.httpkit.client :as http]
66 [cheshire.core :as json]
7- [clj-uuid :as uuid]
87 [clj-time
98 [core :as t]
109 [format :as ft]])
1110 (:import
12- (java.net InetAddress)))
11+ (java.net InetAddress)
12+ (java.util UUID)))
1313
1414(defonce ^:private fallback (atom {:enabled? false }))
1515
4949 :value (.getMessage e)}]))
5050
5151(defn- generate-uuid []
52- (str/replace (uuid/v4 ) #"-" " " ))
52+ (str/replace (UUID/randomUUID ) #"-" " " ))
5353
5454(defn- make-sentry-url [uri project-id]
5555 (format " %s/api/%s/store/" uri project-id))
You can’t perform that action at this time.
0 commit comments