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
150
Issues
150
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
49a90269
Verified
Commit
49a90269
authored
Oct 30, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[mail] add MailException to get better error messages
parent
ea7821be
Pipeline
#6913
failed with stages
in 16 minutes and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
Mail.hs
src/Gargantext/Core/Config/Mail.hs
+13
-2
No files found.
src/Gargantext/Core/Config/Mail.hs
View file @
49a90269
...
...
@@ -17,6 +17,7 @@ module Gargantext.Core.Config.Mail (
,
LoginType
(
..
)
,
SendEmailType
(
..
)
,
MailConfig
(
..
)
,
MailException
(
..
)
-- * Utility functions
,
gargMail
...
...
@@ -32,6 +33,7 @@ module Gargantext.Core.Config.Mail (
)
where
import
Control.Exception.Safe
qualified
as
Exc
import
Control.Monad.Fail
(
fail
)
import
Data.Maybe
import
Data.Text
(
unpack
)
...
...
@@ -125,15 +127,24 @@ instance ToTable MailConfig where
-- }
newtype
MailException
=
MailException
SomeException
deriving
(
Show
)
instance
Exception
MailException
data
GargMail
=
GargMail
{
gm_to
::
Email
,
gm_name
::
Maybe
Name
,
gm_subject
::
Text
,
gm_body
::
Text
}
-- | TODO add parameters to gargantext.ini
gargMail
::
MailConfig
->
GargMail
->
IO
()
gargMail
(
MailConfig
{
..
})
(
GargMail
{
..
})
=
do
gargMail
mc
gm
=
do
Exc
.
catch
(
gargMail'
mc
gm
)
$
\
e
->
Exc
.
throw
(
MailException
e
)
gargMail'
::
MailConfig
->
GargMail
->
IO
()
gargMail'
(
MailConfig
{
..
})
(
GargMail
{
..
})
=
do
let
host
=
unpack
_mc_mail_host
user
=
unpack
_mc_mail_user
password
=
unpack
_mc_mail_password
...
...
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