graphql-error-parser

2.0.3 • Public • Published

graphql-error-parser

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'
    }
  }
}
*/

Readme

Keywords

none

Package Sidebar

Install

npm i graphql-error-parser

Weekly Downloads

0

Version

2.0.3

License

MIT

Last publish

Collaborators

  • mfix22