如果遇到某些异常情况,graphql引擎可以引发运行时异常。以下是可以在graphql.execute(…)调用中抛出的异常列表。
这些不是执行中的graphql错误,而是执行graphql查询的完全不可接受的条件。
graphql.schema.CoercingSerializeException
原文:is thrown when a value cannot be serialised by a Scalar type, for example a String value being coerced as an Int.
翻译:当值不能由标量类型序列化时抛出,例如字符串值被强制为Int。
graphql.schema.CoercingParseValueException
原文:is thrown when a value cannot be parsed by a Scalar type, for example a String input value being parsed as an Int.
翻译:当值不能由标量类型解析时抛出,例如,字符串输入值被解析为Int。
graphql.execution.UnresolvedTypeException
原文:is thrown if a
graphql.schema.TypeResolver
fails to provide a concrete object type given a interface or union type.
翻译:如果是graphql.schema,则抛出。TypeResolver无法提供给定接口或联合类型的具体对象类型。
graphql.execution.NonNullableValueCoercedAsNullException
原文:is thrown if a non null variable argument is coerced as a null value during execution.
翻译:如果在执行期间将非空变量参数强制为空值,则引发。
graphql.execution.InputMapDefinesTooManyFieldsException
原文:is thrown if a map used for an input type object contains more keys than is defined in that input type.
翻译:如果用于输入类型对象的映射包含的键多于该输入类型中定义的键,则引发。
graphql.schema.validation.InvalidSchemaException
原文:is thrown if the schema is not valid when built via > graphql.schema.GraphQLSchema.Builder#build()
graphql.execution.UnknownOperationException
原文:if multiple operations are defined in the query and the operation name is missing or there is no matching operation name contained in the GraphQL query.
翻译:如果查询中定义了多个操作,并且缺少操作名,或者GraphQL查询中没有包含匹配的操作名。
graphql.GraphQLException
原文:is thrown as a general purpose runtime exception, for example if the code cant access a named field when examining a POJO, it is analogous to a RuntimeException if you will.
翻译:作为通用运行时异常抛出,例如,如果代码在检查POJO时无法访问命名字段,则类似于运行时异常。
graphql.AssertException
原文:is thrown as a low level code assertion exception for truly unexpected code conditions, things we assert should never happen in practice.
翻译:对于真正意外的代码条件,作为低级代码断言异常抛出,我们断言的事情在实践中永远不会发生。