a356d2f68c
* Add Apollo Server and Client Auth Example * Some updates * Updated docs Co-authored-by: Luis Alvarez D. <luis@zeit.co>
13 lines
317 B
JavaScript
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
|
|
}
|