An open API service indexing awesome lists of open source software.

https://github.com/mfix22/graphql-error-parser

Create field summary from GraphQL error response
https://github.com/mfix22/graphql-error-parser

Last synced: 2 months ago
JSON representation

Create field summary from GraphQL error response

Awesome Lists containing this project

README

        

# `graphql-error-parser`

```javascript
const parse = require('graphql-error-parser')
const err = 'Variable "$input" got invalid value {"id":"3","address":{"zip":"1","state":"MN","streetAddress1":"Test"}}.\nIn field "address": In field "city": Expected "String!", found null.\nIn field "address": In field "zip": Expected type "ZipCode", found "1": 00001 is not a valid zipcode'

parse(err)
/*
{
address: {
city: {
type: 'String!',
message: ''
},
zip: {
type: 'ZipCode',
message: '00001 is not a valid zipcode'
}
}
}
*/
```