ez-couch 0.6.1 → 0.6.2
raw patch · 7 files changed
+22/−9 lines, 7 filesdep +tlsPVP ok
version bump matches the API change (PVP)
Dependencies added: tls
API changes (from Hackage documentation)
Files
- ez-couch.cabal +3/−2
- src/EZCouch/EntityIsolation.hs +2/−1
- src/EZCouch/ReadAction.hs +1/−1
- src/EZCouch/Types.hs +3/−1
- src/EZCouch/View.hs +3/−2
- src/Network/HTTP/Conduit/Request.hs +8/−1
- src/Util/Logging.hs +2/−1
ez-couch.cabal view
@@ -1,5 +1,5 @@ name: ez-couch-version: 0.6.1+version: 0.6.2 cabal-version: >=1.8 build-type: Simple license: MIT@@ -68,7 +68,8 @@ classy-prelude >= 0.5.0, classy-prelude-conduit, hashable >= 1.1,- vector + vector,+ tls source-repository head type: git
src/EZCouch/EntityIsolation.hs view
@@ -109,5 +109,6 @@ deleteIsolations :: (MonadAction m, Entity e) => [Isolation e] -> m ()-deleteIsolations = deleteEntitiesByIdRevs . map isolationIdRev+deleteIsolations = + void . tryOperation . deleteEntitiesByIdRevs . map isolationIdRev
src/EZCouch/ReadAction.hs view
@@ -41,7 +41,7 @@ case result of ResponseNotFound -> do logLn 2 $ "View " - ++ fromMaybe undefined (viewGeneratedName view) + ++ fromMaybe (crash "Unnamed view") (viewGeneratedName view) ++ " does not exist. Generating." createOrUpdateView view action path qps body >>= \r -> case r of
src/EZCouch/Types.hs view
@@ -8,6 +8,7 @@ import Data.Aeson import GHC.Generics import EZCouch.Entity+import EZCouch.Crash -- | A wrapper for entity values which preserves the information required for -- identifying the appropriate documents in the db.@@ -24,7 +25,8 @@ persistedIdHashPart :: Entity a => Persisted a -> Text persistedIdHashPart (Persisted id _ value) = - fromMaybe undefined $ stripPrefix (entityType value ++ "-") id+ fromMaybe (crash $ "Unexpected id: " ++ show id) $ + stripPrefix (entityType value ++ "-") id type Identified a = (Text, a)
src/EZCouch/View.hs view
@@ -10,6 +10,7 @@ import EZCouch.Types import EZCouch.Design import EZCouch.WriteAction+import EZCouch.Crash import qualified Control.Monad as Monad import qualified Data.Foldable as Foldable import qualified EZCouch.Model.Design as DesignModel@@ -142,8 +143,8 @@ viewPath :: (Entity a) => View a k -> [Text] viewPath view = case view of ViewById -> ["_all_docs"]- _ -> ["_design", fromMaybe undefined $ viewDesignName view, - "_view", fromMaybe undefined $ viewGeneratedName view]+ _ -> ["_design", fromMaybe (crash "No view design") $ viewDesignName view, + "_view", fromMaybe (crash "No view name") $ viewGeneratedName view] createOrUpdateView :: (MonadAction m, Entity a) => View a k
src/Network/HTTP/Conduit/Request.hs view
@@ -5,6 +5,7 @@ import ClassyPrelude import Network.HTTP.Conduit import Network.HTTP.Types+import qualified Network.TLS as TLS withHeader (name, value) request = request { requestHeaders = headers' }@@ -41,9 +42,15 @@ = request { responseTimeout = timeout } fixedHTTP request manager - = http request manager `catch` handleIOException+ = flip catch handleTLSHandshakeFailed $+ flip catch handleIOException $+ http request manager where handleIOException (e :: IOException) = throwIO + $ FailedConnectionException + (unpack $ decodeUtf8 $ host request) + (port request)+ handleTLSHandshakeFailed (e :: TLS.HandshakeFailed) = throwIO $ FailedConnectionException (unpack $ decodeUtf8 $ host request) (port request)
src/Util/Logging.hs view
@@ -43,7 +43,8 @@ 6 -> ALERT x | x >= 7 -> EMERGENCY -priorityLevel p = fromMaybe undefined $ find ((==) p . levelPriority) [0..7]+priorityLevel p = fromMaybe fail $ find ((==) p . levelPriority) [0..7]+ where fail = error $ "Unexpected priority " ++ show p formatter format h (prio, msg) loggername = replaceVarM