summaryrefslogtreecommitdiff
path: root/src/Language/GraphQL/Error.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2021-05-10 09:43:39 +0200
committerEugen Wissner <belka@caraus.de>2021-05-10 09:43:39 +0200
commit1af95345d21ecfaa0823cc5343d2ccc83c89d449 (patch)
tree1fc442bf20d116254a39c4ab17659d9e88dcfe68 /src/Language/GraphQL/Error.hs
parent0d23df3da29cfe0b78af922cea71db5fa1d5c98c (diff)
downloadgraphql-1af95345d21ecfaa0823cc5343d2ccc83c89d449.tar.gz
Deprecate internal error generation functions
The functions generating errors in the executor should be changed anyway when we provide better error messages from the executor, with the error location and response path. So public definitions of these functions are deprecated now and they are replaced by more generic functions in the executor code.
Diffstat (limited to 'src/Language/GraphQL/Error.hs')
-rw-r--r--src/Language/GraphQL/Error.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Language/GraphQL/Error.hs b/src/Language/GraphQL/Error.hs
index d3625a7..2061c20 100644
--- a/src/Language/GraphQL/Error.hs
+++ b/src/Language/GraphQL/Error.hs
@@ -69,21 +69,25 @@ parseError ParseErrorBundle{..} =
type CollectErrsT m = StateT (Resolution m) m
-- | Adds an error to the list of errors.
+{-# DEPRECATED #-}
addErr :: Monad m => Error -> CollectErrsT m ()
addErr v = modify appender
where
appender :: Monad m => Resolution m -> Resolution m
appender resolution@Resolution{..} = resolution{ errors = errors |> v }
+{-# DEPRECATED #-}
makeErrorMessage :: Text -> Error
makeErrorMessage s = Error s [] []
-- | Constructs a response object containing only the error with the given
-- message.
+{-# DEPRECATED #-}
singleError :: Serialize a => Text -> Response a
-singleError message = Response null $ Seq.singleton $ makeErrorMessage message
+singleError message = Response null $ Seq.singleton $ Error message [] []
-- | Convenience function for just wrapping an error message.
+{-# DEPRECATED #-}
addErrMsg :: (Monad m, Serialize a) => Text -> CollectErrsT m a
addErrMsg errorMessage = (addErr . makeErrorMessage) errorMessage >> pure null