@jumpn/utils-graphql
GraphQL utilities
Types
type GqlErrorLocation = {
line: number,
column: number
};
type GqlError = {
message: string,
locations?: Array<GqlErrorLocation>
};
type GqlResponse<Data> = {
data?: Data,
errors?: Array<GqlError>
};
API
errorsToString
Transforms an array of GqlError into a string.
Parameters
gqlErrors
Array<GqlError>
Examples
const gqlRespose = {
errors: [
{message: "First Error", locations: [{column: 10, line: 2}]},
{message: "Second Error", locations: [{column: 2, line: 4}]}
]
}
const error = errorsToString(gqlRespose.errors);
Returns string
License
MIT :copyright: Jumpn Limited / Mauro Titimoli (mauro@jumpn.com)