Revert poorly thought out error squashing. Any error in a transaction kills the transaction anyways.

This commit is contained in:
Alexander K. Hudek 2014-12-23 02:10:31 -05:00
parent 12de925465
commit ad0d1bc7e2
4 changed files with 10 additions and 14 deletions

View file

@ -1,4 +1,4 @@
(defproject views "0.4.6" (defproject views "0.4.7"
:description "You underestimate the power of the SQL side" :description "You underestimate the power of the SQL side"
:url "https://github.com/diligenceengine/views" :url "https://github.com/diligenceengine/views"

View file

@ -3,7 +3,7 @@
(:require (:require
[clojure.string :refer [split]] [clojure.string :refer [split]]
[clojure.java.jdbc :as j] [clojure.java.jdbc :as j]
[clojure.tools.logging :refer [debug]] [clojure.tools.logging :refer [debug error]]
[honeysql.core :as hsql] [honeysql.core :as hsql]
[honeysql.helpers :as hh] [honeysql.helpers :as hh]
[views.db.load :as vdbl] [views.db.load :as vdbl]
@ -219,10 +219,11 @@
(try (try
(let [refresh-set (get (vdbl/initial-view db view-sig templates view) view-sig)] (let [refresh-set (get (vdbl/initial-view db view-sig templates view) view-sig)]
(update-in d [view-sig] (update-deltas-with-refresh-set refresh-set))) (update-in d [view-sig] (update-deltas-with-refresh-set refresh-set)))
;; allow serialization errors ;; report bad view-sig on error
(catch SQLException e (if (serialization-error? e) (throw e) d)) (catch Exception e
;; ignore any failed view deltas (error "error refreshing view" view-sig)
(catch Exception e (log-exception e) d))) (log-exception e)
(throw e))))
deltas deltas
refresh-only-views)) refresh-only-views))

View file

@ -30,12 +30,7 @@
(into []) (into [])
(post-process-result-set new-view templates) (post-process-result-set new-view templates)
(hash-map new-view)) (hash-map new-view))
(catch SQLException e
(if (serialization-error? e)
(throw e)
(do
(warn "Broken view sig: " (pr-str new-view))
(log-exception e))))
(catch Exception e (catch Exception e
(error "when computing initial-view for" new-view) (error "when computing initial-view for" new-view)
(log-exception e)))) (log-exception e)
(throw e))))

View file

@ -33,7 +33,7 @@
(is (= (subscriptions (:persistence config) bsv/default-ns [[:users]]) (is (= (subscriptions (:persistence config) bsv/default-ns [[:users]])
{[:users] #{1}})) {[:users] #{1}}))
;; Verify sends occured. ;; Verify sends occured.
(is (= @sent #{[1 :views.init {[:users] []}]})))) (is (= #{[1 :views.init {[:users] []}]} @sent))))
;; This test illustrates a slight timing issue. Because view subscriptions ;; This test illustrates a slight timing issue. Because view subscriptions
;; use threads, an unsubscription that follows a subscription too closely ;; use threads, an unsubscription that follows a subscription too closely