Class Error
java.lang.Object
com.graphql_java_generator.client.response.Error
public class Error
extends java.lang.Object
The error POJO, mapped from the GraphQL server response, when an error occurs
- Author:
- etienne-sf
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
description
java.lang.String
errorType
com.fasterxml.jackson.databind.JsonNode
extensions
The extensions field of errors, stored as is from the incoming GraphQL response.java.util.List<Location>
locations
java.lang.String
message
java.util.List<java.lang.String>
path
java.util.List<java.lang.String>
queryPath
java.lang.String
validationErrorType
-
Constructor Summary
Constructors Constructor Description Error()
-
Method Summary
Modifier and Type Method Description com.fasterxml.jackson.databind.JsonNode
getExtensions()
java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode>
getExtensionsAsMap()
Returns the extensions as a map.java.util.Map<java.lang.String,java.lang.String>
getExtensionsAsMapStringString()
Returns the extensions as a map.<T> T
getExtensionsField(java.lang.String key, java.lang.Class<T> t)
Parse the value for the given _key_, as found in the extensions field of the GraphQL server's response, into the given _t_ class.void
setExtensions(com.fasterxml.jackson.databind.JsonNode extensions)
java.lang.String
toString()
Logs this error to the givenLogger
-
Field Details
-
message
public java.lang.String message -
locations
-
description
public java.lang.String description -
validationErrorType
public java.lang.String validationErrorType -
queryPath
public java.util.List<java.lang.String> queryPath -
errorType
public java.lang.String errorType -
path
public java.util.List<java.lang.String> path -
extensions
public com.fasterxml.jackson.databind.JsonNode extensionsThe extensions field of errors, stored as is from the incoming GraphQL response. It can be retrieved thanks to one of these methods:getExtensions()
,getExtensionsAsMap()
,getExtensionsField(String, Class)
-
-
Constructor Details
-
Error
public Error()
-
-
Method Details
-
toString
public java.lang.String toString()Logs this error to the givenLogger
- Overrides:
toString
in classjava.lang.Object
- Parameters:
logger
-
-
getExtensions
public com.fasterxml.jackson.databind.JsonNode getExtensions() -
setExtensions
public void setExtensions(com.fasterxml.jackson.databind.JsonNode extensions) -
getExtensionsAsMap
public java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> getExtensionsAsMap()Returns the extensions as a map. The values can't be deserialized, as their type is unknown.- Returns:
-
getExtensionsAsMapStringString
public java.util.Map<java.lang.String,java.lang.String> getExtensionsAsMapStringString()Returns the extensions as a map. The values can't be deserialized, as their type is unknown.- Returns:
-
getExtensionsField
public <T> T getExtensionsField(java.lang.String key, java.lang.Class<T> t) throws com.fasterxml.jackson.core.JsonProcessingExceptionParse the value for the given _key_, as found in the extensions field of the GraphQL server's response, into the given _t_ class.- Type Parameters:
T
-- Parameters:
key
-t
-- Returns:
- null if the key is not in the extensions map. Otherwise: the value for this _key_, as a _t_ instance
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- When there is an error when converting the key's value into the _t_ class
-