hats 0.1.0.0 → 0.1.0.1
raw patch · 4 files changed
+18/−8 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.md +10/−0
- hats.cabal +1/−1
- src/Network/Nats/Connection.hs +6/−6
- src/Network/Nats/JsonApi.hs +1/−1
CHANGES.md view
@@ -1,3 +1,13 @@+# 0.1.0.1++* Made exception handling for exceptions from the network package a little+ more robust. Exceptions from the network package is just strings, and+ matching of errors need to be done by string matching. If a string is+ changing the exception handler can fail. Added substring matching to+ better handle this case.++* Fixing a documentation bug.+ # 0.1.0.0 * Initial release of hats - NATS client for Haskell.
hats.cabal view
@@ -1,5 +1,5 @@ name: hats-version: 0.1.0.0+version: 0.1.0.1 synopsis: Haskell client for the NATS messaging system description: A Haskell client for the NATS messaging system. To get started,
src/Network/Nats/Connection.hs view
@@ -61,10 +61,10 @@ -- | Make a new 'Connection' as specified by the URI. Provide one -- 'Upstream' queue with data from the application to the server, and -- one 'Downstream' queue with data from the server to the application.-makeConnection :: Tmo -> URI -> Upstream -> Downstream -> SubscriberMap +makeConnection :: Tmo -> URI -> Upstream -> Downstream -> SubscriberMap -> IO (Maybe Connection) makeConnection tmo uri fromApp toApp subscriberMap =- connectionError `handle` (Just <$> makeConnection' tmo uri fromApp + connectionError `handle` (Just <$> makeConnection' tmo uri fromApp toApp subscriberMap) where connectionError :: SomeException -> IO (Maybe Connection)@@ -75,7 +75,7 @@ case fromException e of (Just HandshakeException) -> return Nothing _ -> throwIO e- + makeConnection' :: Tmo -> URI -> Upstream -> Downstream -> SubscriberMap -> IO Connection makeConnection' tmo uri fromApp toApp subscriberMap = do@@ -169,7 +169,7 @@ -- | Extract credentials (if any) from the 'URI'. credentialsFromUri :: URI -> (Maybe BS.ByteString, Maybe BS.ByteString)-credentialsFromUri = +credentialsFromUri = toBS . extractCredentials . uriUserInfo. fromJust . uriAuthority where toBS (user, pass) = (BS.pack <$> user, BS.pack <$> pass)@@ -177,7 +177,7 @@ -- | Resolve a 'HostName' and a 'PortNumber' to a 'SockAddr'. toSockAddr :: HostName -> PortNumber -> IO SockAddr toSockAddr host port =- addrAddress . head <$> getAddrInfo (Just defaultHints) + addrAddress . head <$> getAddrInfo (Just defaultHints) (Just host) (Just $ show port) @@ -205,7 +205,7 @@ -- | Awkward, but this is how to check for connection refuse. isConnectionRefused :: SomeException -> Bool isConnectionRefused e =- show e == "connect: does not exist (Connection refused)"+ "connect: does not exist (Connection refused)" `isInfixOf` show e -- | Equally awkward, but this is how to check for resolv errors. isResolvError :: SomeException -> Bool
src/Network/Nats/JsonApi.hs view
@@ -23,7 +23,7 @@ publishJson nats topic replyTo = publish nats topic replyTo . encode {-# INLINE publishJson #-} --- | As 'request', but with JSON payload and 'JsonMsg' reply.+-- | As 'request', but with JSON payload. requestJson :: ToJSON a => Nats -> Topic -> a -> IO Msg requestJson nats topic = request nats topic . encode {-# INLINE requestJson #-}