Permalink
Browse files

Fixed a Clojure 1.3.0 incompatibility with exception handling.

  • Loading branch information...
gcv committed Oct 3, 2011
1 parent 4942b50 commit acc80e5c399d81b425bae7a58f9d8f96c7e5c200
Showing with 8 additions and 1 deletion.
  1. +6 −1 src/appengine_magic/services/datastore.clj
  2. +2 −0 test/test/appengine_magic/services/datastore.clj
@@ -374,7 +374,12 @@
:or {kind (unqualified-name (.getName entity-record-type))}}]
(try
(retrieve-helper entity-record-type key-value-or-values :parent parent :kind kind)
- (catch EntityNotFoundException _ nil)))
+ ;; XXX: Clojure 1.2.x only:
+ (catch EntityNotFoundException _ nil)
+ ;; XXX: Clojure 1.3.x:
+ (catch Exception ex (if (isa? (class (.getCause ex)) EntityNotFoundException)
+ nil
+ (throw ex)))))
(defn exists? [entity-record-type key-value-or-values &
@@ -38,6 +38,8 @@
(is (= alice alice-queried))
(is (= bob bob-retrieved))
(is (= charlie charlie-retrieved)))
+ ;; retrieve non-stored entity
+ (is (nil? (ds/retrieve Author "Drew")))
;; sorted query
(let [[charlie-queried bob-queried alice-queried] (ds/query :kind Author
:sort [[:name :desc]])]

0 comments on commit acc80e5

Please sign in to comment.