packages feed

cloudi 2.0.0 → 2.0.1

raw patch · 3 files changed

+41/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Foreign.CloudI: data FatalError
+ Foreign.CloudI: instance GHC.Exception.Type.Exception Foreign.CloudI.FatalError
+ Foreign.CloudI: instance GHC.Show.Show Foreign.CloudI.FatalError

Files

cloudi.cabal view
@@ -1,5 +1,5 @@ name:                cloudi-version:             2.0.0+version:             2.0.1 synopsis:            Haskell CloudI API description:         Haskell CloudI API (see https://cloudi.org for more details) homepage:            https://github.com/CloudI/cloudi_api_haskell
src/Foreign/CloudI.hs view
@@ -42,6 +42,7 @@     , messageDecodingError     , terminateError     , Exception+    , FatalError     , Result     , api     , threadCount@@ -101,6 +102,8 @@ import qualified System.IO.Error as SysIOErr import qualified System.IO.Unsafe as Unsafe import qualified System.Posix.Env as POSIX (getEnv)+import qualified System.Posix.Process as POSIX (exitImmediately)+import qualified System.Exit as Exit type Array = IArray.Array type Builder = Builder.Builder type ByteString = ByteString.ByteString@@ -110,6 +113,10 @@ type Map = Map.Map type RequestType = Instance.RequestType type SomeException = Exception.SomeException+type SomeAsyncException = Exception.SomeAsyncException+type AsyncException = Exception.AsyncException+type AssertionFailed = Exception.AssertionFailed+type ExitCode = Exit.ExitCode type Source = Instance.Source type ThreadId = Concurrent.ThreadId type Word32 = Word.Word32@@ -165,6 +172,13 @@  instance Typeable s => Exception.Exception (Exception s) +data FatalError = FatalError++instance Exception.Exception FatalError++instance Show FatalError where+    showsPrec _ FatalError = showString "FatalError"+ printException :: String -> IO () printException str =     SysIO.hPutStrLn SysIO.stderr ("Exception: " ++ str)@@ -219,7 +233,9 @@                             return $ Left err                         Right (_, api1) ->                             return $ Right api1-        (_, _) ->+        (_, _) -> do+            SysIO.hPutStrLn SysIO.stderr+                "CloudI service execution must occur in CloudI"             return $ Left invalidInputError  -- | returns the thread count from the service configuration@@ -636,6 +652,26 @@ nullResponse _ _ _ _ _ _ _ _ _ state api0 =     return $ Instance.Null (state, api0) +callbackExceptionFatal :: SomeException -> IO ()+callbackExceptionFatal e = do+    printException $ show e+    POSIX.exitImmediately (Exit.ExitFailure 1)++callbackException :: SomeException -> IO ()+callbackException e+    | Just _ <- (Exception.fromException e :: Maybe AsyncException) =+        callbackExceptionFatal e+    | Just _ <- (Exception.fromException e :: Maybe SomeAsyncException) =+        callbackExceptionFatal e+    | Just _ <- (Exception.fromException e :: Maybe AssertionFailed) =+        callbackExceptionFatal e+    | Just _ <- (Exception.fromException e :: Maybe FatalError) =+        callbackExceptionFatal e+    | Just exitCode <- (Exception.fromException e :: Maybe ExitCode) =+        POSIX.exitImmediately exitCode+    | otherwise =+        printException $ show e+ callback :: Typeable s => Instance.T s ->     (RequestType, ByteString, ByteString, ByteString, ByteString,      Int, Int, ByteString, Source) -> IO (Result (Instance.T s))@@ -650,7 +686,7 @@             Just functionQueue ->                 let f = Sequence.index functionQueue 0                     functionQueueNew = (Sequence.|>)-                        (Sequence.drop 0 functionQueue) f+                        (Sequence.drop 1 functionQueue) f                 in                 (f, Map.insert pattern functionQueueNew callbacks)         api1 = api0{Instance.callbacks = callbacksNew}@@ -720,7 +756,7 @@                     return $ ReturnI (empty, empty, v0, v1)     callbackResultType <- case callbackResultValue of         Left exception -> do-            printException $ show (exception :: Exception.SomeException)+            callbackException exception             return $ ReturnI (empty, empty, state, api1)         Right callbackResult ->             return $ callbackResult
src/Foreign/CloudI/Instance.hs view
@@ -267,7 +267,7 @@             Nothing ->                 error "callbacks empty"             Just functionQueue ->-                let functionQueueNew = Sequence.drop 0 functionQueue in+                let functionQueueNew = Sequence.drop 1 functionQueue in                 if Sequence.null functionQueueNew then                     Map.delete key callbacks0                 else