【发布时间】:2019-07-20 21:35:59
【问题描述】:
我正在使用 graphqljs 和 express-graphql。每当我遇到错误时,我都会得到一些模糊的东西,比如 "Expected type Int!, found \"1\" 带有无用的位置属性:
"locations": [
{
"line": 3,
"column": 42
}
],
如何获取文件名及其行?
以下错误:
"{
"errors": [
{
"json": "{\"message\":\"Expected type Int!, found \\\"1\\\".\",\"locations\":[{\"line\":3,\"column\":42}]}",
"message": "Expected type Int!, found \"1\".",
"locations": [
{
"line": 3,
"column": 42
}
],
"stack": [
"GraphQLError: Expected type Int!, found \"1\".",
" at isValidScalar (/Applications/MAMP/htdocs/whylookforit-server/node_modules/graphql/validation/rules/ValuesOfCorrectType.js:164:27)",
" at Object.StringValue (/Applications/MAMP/htdocs/whylookforit-server/node_modules/graphql/validation/rules/ValuesOfCorrectType.js:128:14)",
" at Object.enter (/Applications/MAMP/htdocs/whylookforit-server/node_modules/graphql/language/visitor.js:333:29)",
" at Object.enter (/Applications/MAMP/htdocs/whylookforit-server/node_modules/graphql/language/visitor.js:384:25)",
" at visit (/Applications/MAMP/htdocs/whylookforit-server/node_modules/graphql/language/visitor.js:251:26)",
" at validate (/Applications/MAMP/htdocs/whylookforit-server/node_modules/graphql/validation/validate.js:63:22)",
" at /Applications/MAMP/htdocs/whylookforit-server/node_modules/express-graphql/dist/index.js:154:52",
" at processTicksAndRejections (internal/process/next_tick.js:81:5)"
]
}
]
}"
【问题讨论】:
标签: javascript node.js graphql graphql-js