-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Hi it seems error are being shallow somewhere when the value of GraphQLEmail
doesn't conform, when using a string instead of a email I don't get a specific error message.
mutation {
viewer {
# wrong email type ( missing @ )
createUser(email: "asdasail.com" password: "123") {
success
}
}
}
just this
{
"message": "unexpected error"
}
And I get the error on my node terminal
2017-05-18T14:17:55.881Z : ERROR : REQ : POST /graphql? : 500 : Query error: Not a valid Email address : (58eba048307ce2316004bb2c) : [Object]: {
"stack": "GraphQLError\n at parser (...\\node_modules\\graphql-custom-types\\lib\\factory.js:37:17)\n at parseLiteral (...\\node_modules\\graphql-custom-types\\lib\\types.js:38:16)\n at GraphQLCustomScalarType.parseLiteral (...\\node_modules\\graphql\\type\\definition.js:215:21)\n at isValidLiteralValue (...\\node_modules\\graphql\\utilities\\isValidLiteralValue.js:113:26)\n at isValidLiteralValue (...\\node_modules\\graphql\\utilities\\isValidLiteralValue.js:51:12)\n at Object.Argument (...\\node_modules\\graphql\\validation\\rules\\ArgumentsOfCorrectType.js:40:67)\n at Object.enter (...\\node_modules\\graphql\\language\\visitor.js:297:29)\n at Object.enter (...\\node_modules\\graphql\\language\\visitor.js:339:25)\n at visit (...\\node_modules\\graphql\\language\\visitor.js:229:26)\n at visitUsingRules (...\\node_modules\\graphql\\validation\\validate.js:77:22)\n at Object.validate (...\\node_modules\\graphql\\validation\\validate.js:62:10)\n at doRunQuery (...\\node_modules\\graphql-server-core\\src\\runQuery.ts:115:34)\n at ...\\node_modules\\graphql-server-core\\src\\runQuery.ts:59:39\n at process._tickDomainCallback (internal/process/next_tick.js:135:7)",
"message": "Query error: Not a valid Email address",
"locations": [
{
"line": 3,
"column": 23
}
],
"nodes": [
{
"kind": "StringValue",
"value": "asdasail.com",
"loc": {
"start": 44,
"end": 58
}
}
],
"source": {
"body": "mutation {\n viewer {\n createUser(email: \"asdasail.com\" password: \"123\") {\n success\n }\n }\n}",
"name": "GraphQL"
},
"positions": [
44
]
}
GraphQLError
at parser (...\node_modules\graphql-custom-types\lib\factory.js:37:17)
at parseLiteral (...\node_modules\graphql-custom-types\lib\types.js:38:16)
at GraphQLCustomScalarType.parseLiteral (...\node_modules\graphql\type\definition.js:215:21)
at isValidLiteralValue (...\node_modules\graphql\utilities\isValidLiteralValue.js:113:26)
at isValidLiteralValue (...\node_modules\graphql\utilities\isValidLiteralValue.js:51:12)
at Object.Argument (...\node_modules\graphql\validation\rules\ArgumentsOfCorrectType.js:40:67)
at Object.enter (...\node_modules\graphql\language\visitor.js:297:29)
at Object.enter (...\node_modules\graphql\language\visitor.js:339:25)
at visit (...\node_modules\graphql\language\visitor.js:229:26)
at visitUsingRules (...\node_modules\graphql\validation\validate.js:77:22)
at Object.validate (...\node_modules\graphql\validation\validate.js:62:10)
at doRunQuery (...\node_modules\graphql-server-core\src\runQuery.ts:115:34)
at ...\node_modules\graphql-server-core\src\runQuery.ts:59:39
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
When normally you use wrong types GraphQL gives you more information. Examples using Number instead of String in password argument.
mutation {
viewer {
createUser(email: "[email protected]" password: 123) {
success
}
}
}
{
"errors": [
{
"message": "Argument \"password\" has invalid value 123.\nExpected type \"String\", found 123.",
"locations": [
{
"line": 3,
"column": 51
}
]
}
]
}
All I use is a simple catch error throw
resolve() {
try {
// ... code
} catch(error) {
throw error
}
}
Metadata
Metadata
Assignees
Labels
No labels