diff options
Diffstat (limited to 'src/Language/GraphQL/Error.hs')
| -rw-r--r-- | src/Language/GraphQL/Error.hs | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/src/Language/GraphQL/Error.hs b/src/Language/GraphQL/Error.hs index 4e461f0..87ee702 100644 --- a/src/Language/GraphQL/Error.hs +++ b/src/Language/GraphQL/Error.hs @@ -15,16 +15,13 @@ module Language.GraphQL.Error , ResolverException(..) , Response(..) , ResponseEventStream - , addErr - , addErrMsg , parseError , runCollectErrs - , singleError ) where import Conduit import Control.Exception (Exception(..)) -import Control.Monad.Trans.State (StateT, modify, runStateT) +import Control.Monad.Trans.State (StateT, runStateT) import Data.HashMap.Strict (HashMap) import Data.Sequence (Seq(..), (|>)) import qualified Data.Sequence as Seq @@ -103,11 +100,9 @@ instance Exception ResolverException -- * Deprecated +{-# DEPRECATED runCollectErrs "runCollectErrs was part of the old executor and isn't used anymore" #-} -- | Runs the given query computation, but collects the errors into an error -- list, which is then sent back with the data. --- --- /runCollectErrs was part of the old executor and isn't used anymore, it will --- be deprecated in the future and removed./ runCollectErrs :: (Monad m, Serialize a) => HashMap Name (Schema.Type m) -> CollectErrsT m a @@ -117,40 +112,13 @@ runCollectErrs types' res = do $ Resolution{ errors = Seq.empty, types = types' } pure $ Response dat errors +{-# DEPRECATED Resolution "Resolution was part of the old executor and isn't used anymore" #-} -- | Executor context. --- --- /Resolution was part of the old executor and isn't used anymore, it will be --- deprecated in the future and removed./ data Resolution m = Resolution { errors :: Seq Error , types :: HashMap Name (Schema.Type m) } +{-# DEPRECATED CollectErrsT "CollectErrsT was part of the old executor and isn't used anymore" #-} -- | A wrapper to pass error messages around. --- --- /CollectErrsT was part of the old executor and isn't used anymore, it will be --- deprecated in the future and removed./ 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 $ 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 |
