rsnext/examples/api-routes-apollo-server-and-client-auth/lib/form.js
Aaron Reisman a356d2f68c Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example

* Some updates

* Updated docs

Co-authored-by: Luis Alvarez D. <luis@zeit.co>
2020-01-23 14:55:45 -05:00

13 lines
317 B
JavaScript

export function getErrorMessage(error) {
if (error.graphQLErrors) {
for (const graphQLError of error.graphQLErrors) {
if (
graphQLError.extensions &&
graphQLError.extensions.code === 'BAD_USER_INPUT'
) {
return graphQLError.message
}
}
}
return error.message
}