Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
958fe77f
Commit
958fe77f
authored
Oct 23, 2023
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a Gargantext.API.Errors module
parent
c71dbb14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
gargantext.cabal
gargantext.cabal
+1
-0
Errors.hs
src/Gargantext/API/Errors.hs
+36
-0
No files found.
gargantext.cabal
View file @
958fe77f
...
...
@@ -51,6 +51,7 @@ library
Gargantext.API.Admin.Types
Gargantext.API.Auth.PolicyCheck
Gargantext.API.Dev
Gargantext.API.Errors
Gargantext.API.HashedResponse
Gargantext.API.Ngrams
Gargantext.API.Ngrams.Prelude
...
...
src/Gargantext/API/Errors.hs
0 → 100644
View file @
958fe77f
module
Gargantext.API.Errors
where
import
Prelude
import
GHC.Stack
import
Control.Exception
import
qualified
Data.Text
as
T
-- | A 'WithStacktrace' carries an error alongside its
-- 'CallStack', to be able to print the correct source location
-- of where the error originated.
data
WithStacktrace
e
=
WithStacktrace
{
ct_callStack
::
!
CallStack
,
ct_error
::
!
e
}
deriving
Show
instance
Exception
e
=>
Exception
(
WithStacktrace
e
)
where
displayException
WithStacktrace
{
..
}
=
displayException
ct_error
<>
"
\n
"
<>
prettyCallStack
ct_callStack
-- | An error that can be returned to the frontend. It carries a human-friendly
-- diagnostic, the 'type' of the error as well as some context-specific data.
data
FrontendError
a
=
FrontendError
{
fe_diagnostic
::
!
T
.
Text
,
fe_type
::
!
BackendErrorType
,
fe_data
::
Maybe
a
}
deriving
(
Show
,
Eq
)
-- | A (hopefully and eventually) exhaustive list of backend errors.
data
BackendErrorType
=
BE_phylo_corpus_not_ready
|
BE_not_good_enough_ratio
|
BE_node_not_found
deriving
(
Show
,
Eq
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment