Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from soundcloud/master

Remove warning about *root-dir* not being dynamic
  • Loading branch information...
commit 57c0fba1172b51221ce59ef3033396cc23092c6d 2 parents 0795193 + fc0d7aa
@zk authored
Showing with 48 additions and 35 deletions.
  1. +42 −28 README.md
  2. +4 −5 project.clj
  3. +2 −2 src/clj_exceptional.clj
View
70 README.md
@@ -5,18 +5,22 @@ A Clojure client for [Exceptional](http://getexceptional.com).
## Usage
### Lein / Cake
-
- [clj-exceptional "0.7.1"]
+
+```clojure
+[clj-exceptional "0.7.1"]
+```
### Importing
- (ns foo
- (:require [clj-exceptional :as cx]))
+```clojure
+(ns foo
+ (:require [clj-exceptional :as cx]))
- ;; or
+;; or
- (ns foo
- (:use cljs-exceptional))
+(ns foo
+ (:use cljs-exceptional))
+```
For the examples below I'll assume you're using the require method above.
@@ -24,16 +28,21 @@ For the examples below I'll assume you're using the require method above.
Set your key !! IMPORTANT !!:
- (cx/key! "exceptional_app_api_key")
+```clojure
+(cx/key! "exceptional_app_api_key")
+```
Post an exception (blocking):
- (cx/post-exc (Exception. "something went wrong!"))
+```clojure
+(cx/post-exc (Exception. "something went wrong!"))
+```
Post an exception (non-blocking using agents):
- (cx/post-exc-async (Exception. "something went wrong!"))
-
+```clojure
+(cx/post-exc-async (Exception. "something went wrong!"))
+```
@@ -41,32 +50,37 @@ Post an exception (non-blocking using agents):
Wrap some code (`catch-exc` returns the caught exception):
- (cx/catch-exc
- (op-throw-exception))
+```clojure
+(cx/catch-exc
+ (op-throw-exception))
- ;; => #<Exception>
+;; => #<Exception>
+```
Wrap some code (`rethrow-exc` re-throws the caught exception):
-
- (try
- (cx/rethrow-exc
- (op-throws-exception))
- (catch Exception e (println "Something went wrong!!!)))
-
- ;; => nil
-
+
+```clojure
+(try
+ (cx/rethrow-exc
+ (op-throws-exception))
+ (catch Exception e (println "Something went wrong!!!")))
+
+;; => nil
+```
### Ring Handler
clj-exceptional contains ring handlers (`wrap-exceptional-catch` and
`wrap-exceptional-rethrow`) that will add information from
the request map to the post.
- (def ring-app
- (-> routes
- (wrap-params)
- (wrap-file "resources/public")
- (wrap-file-info)
- (cx/wrap-exceptional-catch))
+```clojure
+(def ring-app
+ (-> routes
+ (wrap-params)
+ (wrap-file "resources/public")
+ (wrap-file-info)
+ (cx/wrap-exceptional-catch))
+```
This will send an exceptional post containing request parameters such
as `:remote-addr`, `:uri`, and `:headers`.
View
9 project.clj
@@ -1,8 +1,7 @@
-(defproject clj-exceptional "0.7.1"
+(defproject org.clojars.soundcloud/clj-exceptional "0.7.2"
:description "Clojure client for Exceptional http://getexceptional.com"
- :dependencies [[org.clojure/clojure "1.2.0"]
- [org.clojure/clojure-contrib "1.2.0"]
- [cheshire "1.1.0"]
- [clj-http "0.1.3"]]
+ :dependencies [[org.clojure/clojure "1.4.0"]
+ [cheshire "5.0.1"]
+ [clj-http "0.6.4"]]
:dev-dependencies [[swank-clojure "1.2.0"]
[lein-clojars "0.6.0"]])
View
4 src/clj_exceptional.clj
@@ -5,7 +5,7 @@
(:import [java.text SimpleDateFormat])
(:refer-clojure :exclude [try]))
-(def *root-dir* (.getAbsolutePath (java.io.File. "")))
+(def absolute-root-dir (.getAbsolutePath (java.io.File. "")))
(def date-format "yyyy-MM-dd'T'HH:mm:ssZZZZ")
(def date-formatter (SimpleDateFormat. date-format))
(def _api-key (atom ""))
@@ -107,7 +107,7 @@
(message (.getMessage e))
(occured (now-iso)))
(appenv
- (root-dir *root-dir*)
+ (root-dir absolute-root-dir)
(env java-env)
(language @_language)
(language-version @_language-version))
Please sign in to comment.
Something went wrong with that request. Please try again.