graphql-java使用手冊:part5 運行期異常(Runtime Exceptions )

原文:http://blog.mygraphql.com/wordpress/?p=108框架

運行期異常(Runtime Exceptions )

在一些異常的狀況下, graphql engine 有可能拋出 Runtime exceptions。下面是調用
: graphql.execute(...) 期間可能出現的異常。wordpress

他們不是執行 graphql 查詢中發生的異常。 但仍是不能被忽略。函數

  • graphql.schema.CoercingSerializeException

發生這類型的異常,緣由是序列化Scalar時出錯。如 Int 字段獲取到 String
值。ui

  • graphql.schema.CoercingParseValueException

發生這類型的異常,緣由是解釋輸入的 Scalar 時出錯 ,如 int
參數的實際輸入值是一個 String。code

  • graphql.execution.UnresolvedTypeException

當 graphql.schema.TypeResolver` 不能判斷抽象對象( interface or union
type) 的實際類型( concrete object type) 時發生這個異常。對象

  • graphql.execution.NonNullableValueCoercedAsNullException

若是 個不容許爲 null 的參數,被賦值爲 null。會拋出上面異常。.blog

  • graphql.execution.InputMapDefinesTooManyFieldsException

能夠輸入對象( input type object
)包含了未在Schema中定義的field。就會發生上面異常。ci

  • graphql.schema.validation.InvalidSchemaException

表示在運行下面函數時, Schema 校驗失敗。
: graphql.schema.GraphQLSchema.Builder#build()`get

  • graphql.GraphQLException

這個是通用的異常。如不能訪問 POJO 的 field。這能夠等同於
RuntimeException。input

  • graphql.AssertException

這是內部斷言的預計外異常

事實上不該該發生【譯註:若是拋出了,多是框架有BUG了。】

相關文章
相關標籤/搜索