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
191
Issues
191
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
4e984ba2
Commit
4e984ba2
authored
Aug 25, 2025
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use displayException for notifyJobFailed
parent
b5c9df51
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
Types.hs
src/Gargantext/API/Errors/Types.hs
+15
-1
Types.hs
src/Gargantext/Core/NodeStory/Types.hs
+10
-1
Worker.hs
src/Gargantext/Core/Worker.hs
+1
-1
No files found.
src/Gargantext/API/Errors/Types.hs
View file @
4e984ba2
...
@@ -144,7 +144,21 @@ instance ToJSON BackendInternalError where
...
@@ -144,7 +144,21 @@ instance ToJSON BackendInternalError where
_
->
""
_
->
""
toJSON
err
=
object
[(
"error"
,
String
$
T
.
pack
$
show
err
)]
toJSON
err
=
object
[(
"error"
,
String
$
T
.
pack
$
show
err
)]
instance
Exception
BackendInternalError
instance
Jobs
.
ToHumanFriendlyError
BackendInternalError
where
mkHumanFriendly
e
=
case
e
of
InternalAuthenticationError
{}
->
show
e
InternalJobError
{}
->
show
e
InternalNodeError
{}
->
show
e
InternalServerError
{}
->
show
e
InternalTreeError
{}
->
show
e
InternalUnexpectedError
{}
->
show
e
InternalValidationError
{}
->
show
e
InternalWorkerError
{}
->
show
e
AccessPolicyError
{}
->
show
e
InternalNodeStoryError
nodeStoryErr
->
Jobs
.
mkHumanFriendly
nodeStoryErr
instance
Exception
BackendInternalError
where
displayException
=
T
.
unpack
.
Jobs
.
mkHumanFriendly
instance
HasNodeError
BackendInternalError
where
instance
HasNodeError
BackendInternalError
where
_NodeError
=
_InternalNodeError
_NodeError
=
_InternalNodeError
...
...
src/Gargantext/Core/NodeStory/Types.hs
View file @
4e984ba2
...
@@ -61,13 +61,14 @@ import Data.Profunctor.Product.TH (makeAdaptorAndInstance)
...
@@ -61,13 +61,14 @@ import Data.Profunctor.Product.TH (makeAdaptorAndInstance)
import
Data.Set
qualified
as
Set
import
Data.Set
qualified
as
Set
import
Database.PostgreSQL.Simple.FromField
(
FromField
(
fromField
),
fromJSONField
)
import
Database.PostgreSQL.Simple.FromField
(
FromField
(
fromField
),
fromJSONField
)
import
Gargantext.API.Ngrams.Types
import
Gargantext.API.Ngrams.Types
import
Gargantext.Database.Admin.Types.Node
(
NodeId
(
..
)
)
import
Gargantext.Core.Text.Ngrams
qualified
as
Ngrams
import
Gargantext.Core.Text.Ngrams
qualified
as
Ngrams
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
import
Gargantext.Database.Admin.Config
()
import
Gargantext.Database.Admin.Config
()
import
Gargantext.Database.Admin.Types.Node
(
NodeId
(
..
)
)
import
Gargantext.Database.Prelude
import
Gargantext.Database.Prelude
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
())
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
())
import
Gargantext.Prelude
hiding
(
to
)
import
Gargantext.Prelude
hiding
(
to
)
import
Gargantext.Utils.Jobs.Error
import
Opaleye
(
DefaultFromField
(
..
),
SqlJsonb
,
fromPGSFromField
)
import
Opaleye
(
DefaultFromField
(
..
),
SqlJsonb
,
fromPGSFromField
)
import
qualified
Data.Text
as
T
import
qualified
Data.Text
as
T
...
@@ -200,6 +201,10 @@ data BuildForestError
...
@@ -200,6 +201,10 @@ data BuildForestError
BFE_loop_detected
!
(
Set
VisitedNode
)
BFE_loop_detected
!
(
Set
VisitedNode
)
deriving
(
Show
,
Eq
)
deriving
(
Show
,
Eq
)
instance
ToHumanFriendlyError
BuildForestError
where
mkHumanFriendly
(
BFE_loop_detected
visited
)
=
"Loop detected in ngrams: "
<>
renderLoop
visited
renderLoop
::
Set
VisitedNode
->
T
.
Text
renderLoop
::
Set
VisitedNode
->
T
.
Text
renderLoop
=
T
.
intercalate
" -> "
.
map
(
unNgramsTerm
.
_vn_term
)
.
Set
.
toAscList
renderLoop
=
T
.
intercalate
" -> "
.
map
(
unNgramsTerm
.
_vn_term
)
.
Set
.
toAscList
...
@@ -218,6 +223,10 @@ data NodeStoryError =
...
@@ -218,6 +223,10 @@ data NodeStoryError =
NodeStoryUpsertFailed
BuildForestError
NodeStoryUpsertFailed
BuildForestError
deriving
(
Show
,
Eq
)
deriving
(
Show
,
Eq
)
instance
ToHumanFriendlyError
NodeStoryError
where
mkHumanFriendly
e
=
case
e
of
NodeStoryUpsertFailed
be
->
mkHumanFriendly
be
------------------------------------------------------------------------
------------------------------------------------------------------------
data
NodeStoryEnv
err
=
NodeStoryEnv
data
NodeStoryEnv
err
=
NodeStoryEnv
{
_nse_saver
::
!
(
NodeId
->
ArchiveList
->
DBUpdate
err
()
)
{
_nse_saver
::
!
(
NodeId
->
ArchiveList
->
DBUpdate
err
()
)
...
...
src/Gargantext/Core/Worker.hs
View file @
4e984ba2
...
@@ -143,7 +143,7 @@ notifyJobFailed env (W.State { name }) bm exc = do
...
@@ -143,7 +143,7 @@ notifyJobFailed env (W.State { name }) bm exc = do
let
ji
=
JobInfo
{
_ji_message_id
=
messageId
bm
let
ji
=
JobInfo
{
_ji_message_id
=
messageId
bm
,
_ji_mNode_id
=
getWorkerMNodeId
job
}
,
_ji_mNode_id
=
getWorkerMNodeId
job
}
let
jh
=
WorkerJobHandle
{
_w_job_info
=
ji
}
let
jh
=
WorkerJobHandle
{
_w_job_info
=
ji
}
runWorkerMonad
env
$
markFailed
(
Just
$
UnsafeMkHumanFriendlyErrorText
$
"Worker job failed: "
<>
show
exc
)
jh
runWorkerMonad
env
$
markFailed
(
Just
$
UnsafeMkHumanFriendlyErrorText
$
T
.
pack
$
displayException
exc
)
jh
notifyJobKilled
::
(
HasWorkerBroker
,
HasCallStack
)
notifyJobKilled
::
(
HasWorkerBroker
,
HasCallStack
)
=>
WorkerEnv
=>
WorkerEnv
...
...
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