Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Language.GraphQL.Resolver
Description
Helper functions and exceptions to write resolvers.
Synopsis
- data ServerException
- argument :: (MonadCatch m, FromGraphQL a) => Name -> ReaderT Context m a
- defaultResolver :: MonadCatch m => Name -> Resolve m
Documentation
data ServerException Source #
Exceptions thrown by the functions in this module.
Constructors
FieldNotResolvedException !Text | |
ErroneousArgumentTypeException !Text |
Instances
Exception ServerException Source # | |
Defined in Language.GraphQL.Resolver Methods toException :: ServerException -> SomeException # | |
Show ServerException Source # | |
Defined in Language.GraphQL.Resolver Methods showsPrec :: Int -> ServerException -> ShowS # show :: ServerException -> String # showList :: [ServerException] -> ShowS # |
argument :: (MonadCatch m, FromGraphQL a) => Name -> ReaderT Context m a Source #
Takes an argument name, validates that the argument exists, and optionally converts it to a user-defined type.
defaultResolver :: MonadCatch m => Name -> Resolve m Source #
Default resolver expects that the field value is returned by the parent object. If the parent is not an object or it doesn't contain the requested field name, an error is thrown.