Skip to content
Snippets Groups Projects
Commit e0b18b23 authored by Jens Nolte's avatar Jens Nolte
Browse files

Move CombinedException to utils

parent 0fc8d6c6
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,7 @@ library
Quasar.Subscribable
Quasar.Timer
Quasar.Utils.Concurrent
Quasar.Utils.Exceptions
Quasar.Utils.ExtraT
hs-source-dirs:
src
......
......@@ -21,8 +21,6 @@ module Quasar.ResourceManager (
attachDisposeAction_,
-- ** Initialization
CombinedException,
combinedExceptions,
withRootResourceManager,
-- ** Linking computations to a resource manager
......@@ -32,6 +30,10 @@ module Quasar.ResourceManager (
-- ** Resource manager implementations
newUnmanagedRootResourceManager,
--newUnmanagedDefaultResourceManager,
-- * Reexports
CombinedException,
combinedExceptions,
) where
......@@ -47,6 +49,7 @@ import Quasar.Awaitable
import Quasar.Disposable
import Quasar.Prelude
import Quasar.Utils.Concurrent
import Quasar.Utils.Exceptions
data FailedToRegisterResource = FailedToRegisterResource
......@@ -234,19 +237,6 @@ linkExecution action = do
-- ** Root resource manager
newtype CombinedException = CombinedException (NonEmpty SomeException)
deriving stock Show
instance Exception CombinedException where
displayException (CombinedException exceptions) = intercalate "\n" (header : exceptionMessages)
where
header = mconcat ["CombinedException with ", show (length exceptions), "exceptions:"]
exceptionMessages = (displayException <$> toList exceptions)
combinedExceptions :: CombinedException -> [SomeException]
combinedExceptions (CombinedException exceptions) = toList exceptions
data RootResourceManager
= RootResourceManager ResourceManager (TVar Bool) (TVar (Maybe (Seq SomeException))) (Awaitable ())
......
module Quasar.Utils.Exceptions (
CombinedException(..),
combinedExceptions,
) where
import Control.Exception
import Data.Foldable (toList)
import Data.List.NonEmpty (NonEmpty, nonEmpty)
import Quasar.Prelude
newtype CombinedException = CombinedException (NonEmpty SomeException)
deriving stock Show
instance Exception CombinedException where
displayException (CombinedException exceptions) = intercalate "\n" (header : exceptionMessages)
where
header = mconcat ["CombinedException with ", show (length exceptions), "exceptions:"]
exceptionMessages = (displayException <$> toList exceptions)
combinedExceptions :: CombinedException -> [SomeException]
combinedExceptions (CombinedException exceptions) = toList exceptions
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment