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
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
2590d283
Commit
2590d283
authored
Mar 22, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] adding better error message to runPGSquery.
parent
7e903e99
Pipeline
#300
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
Utils.hs
src/Gargantext/Database/Utils.hs
+16
-2
No files found.
src/Gargantext/Database/Utils.hs
View file @
2590d283
...
...
@@ -20,6 +20,11 @@ commentary with @some markup@.
module
Gargantext.Database.Utils
where
import
Debug.Trace
(
trace
)
import
Prelude
(
String
)
import
Control.Monad
((
>>
))
import
Data.Text
(
Text
)
import
Control.Monad.Error.Class
(
MonadError
(
..
))
import
Control.Lens
(
Getter
,
view
)
import
Control.Monad.Reader
import
Control.Monad.Except
...
...
@@ -80,8 +85,17 @@ runOpaQuery q = mkCmd $ \c -> runQuery c q
formatPGSQuery
::
PGS
.
ToRow
a
=>
PGS
.
Query
->
a
->
Cmd
err
DB
.
ByteString
formatPGSQuery
q
a
=
mkCmd
$
\
conn
->
PGS
.
formatQuery
conn
q
a
runPGSQuery
::
(
PGS
.
ToRow
a
,
PGS
.
FromRow
b
)
=>
PGS
.
Query
->
a
->
Cmd
err
[
b
]
runPGSQuery
q
a
=
mkCmd
$
\
conn
->
PGS
.
query
conn
q
a
runPGSQuery'
::
(
PGS
.
ToRow
a
,
PGS
.
FromRow
b
)
=>
PGS
.
Query
->
a
->
Cmd
err
[
b
]
runPGSQuery'
q
a
=
mkCmd
$
\
conn
->
PGS
.
query
conn
q
a
runPGSQuery
::
(
MonadError
err
m
,
MonadReader
env
m
,
PGS
.
FromRow
r
,
PGS
.
ToRow
q
,
MonadIO
m
,
HasConnection
env
)
=>
PGS
.
Query
->
q
->
m
[
r
]
runPGSQuery
q
a
=
catchError
(
mkCmd
$
\
conn
->
PGS
.
query
conn
q
a
)
(
\
e
->
putStrLn
(
"Text xxxxxxxxxxxxxxxxxxx"
::
String
)
--(\e -> putStrLn ((cs $ formatPGSQuery q a):: Text)
>>
throwError
e
)
execPGSQuery
::
PGS
.
ToRow
a
=>
PGS
.
Query
->
a
->
Cmd
err
Int64
execPGSQuery
q
a
=
mkCmd
$
\
conn
->
PGS
.
execute
conn
q
a
...
...
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