summaryrefslogtreecommitdiff
path: root/src/Language/GraphQL/Execute.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2019-07-23 06:04:33 +0200
committerEugen Wissner <belka@caraus.de>2019-07-23 07:22:32 +0200
commit282946560e14a94748b4a0599ac7419c27848c04 (patch)
tree54341b3653bbde17002d8bc119de2d0688d15c13 /src/Language/GraphQL/Execute.hs
parent1b5094b6a3e6eb68f67bc3238487818f7b7d552a (diff)
downloadgraphql-0.4.0.0.tar.gz
Add singleError utility functionv0.4.0.0
Diffstat (limited to 'src/Language/GraphQL/Execute.hs')
-rw-r--r--src/Language/GraphQL/Execute.hs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/Language/GraphQL/Execute.hs b/src/Language/GraphQL/Execute.hs
index 2a1ff97..9dbfb36 100644
--- a/src/Language/GraphQL/Execute.hs
+++ b/src/Language/GraphQL/Execute.hs
@@ -29,15 +29,11 @@ execute
execute schema subs doc =
maybe transformError (document schema) $ Transform.document subs doc
where
- transformError = return $ Aeson.object
- [("errors", Aeson.toJSON
- [ Aeson.object [("message", "Schema transformation error.")]
- ]
- )]
+ transformError = return $ singleError "Schema transformation error."
document :: MonadIO m => Schema m -> AST.Core.Document -> m Aeson.Value
document schema (op :| []) = operation schema op
-document _ _ = error "Multiple operations not supported yet"
+document _ _ = return $ singleError "Multiple operations not supported yet."
operation :: MonadIO m => Schema m -> AST.Core.Operation -> m Aeson.Value
operation schema (AST.Core.Query flds)