Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
quasar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jens Nolte
quasar
Commits
e0b18b23
Commit
e0b18b23
authored
3 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Move CombinedException to utils
parent
0fc8d6c6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
quasar.cabal
+1
-0
1 addition, 0 deletions
quasar.cabal
src/Quasar/ResourceManager.hs
+5
-15
5 additions, 15 deletions
src/Quasar/ResourceManager.hs
src/Quasar/Utils/Exceptions.hs
+21
-0
21 additions, 0 deletions
src/Quasar/Utils/Exceptions.hs
with
27 additions
and
15 deletions
quasar.cabal
+
1
−
0
View file @
e0b18b23
...
...
@@ -94,6 +94,7 @@ library
Quasar.Subscribable
Quasar.Timer
Quasar.Utils.Concurrent
Quasar.Utils.Exceptions
Quasar.Utils.ExtraT
hs-source-dirs:
src
...
...
This diff is collapsed.
Click to expand it.
src/Quasar/ResourceManager.hs
+
5
−
15
View file @
e0b18b23
...
...
@@ -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
()
)
...
...
This diff is collapsed.
Click to expand it.
src/Quasar/Utils/Exceptions.hs
0 → 100644
+
21
−
0
View file @
e0b18b23
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment