如何获取导致GraphQLError的文件名:语法错误:未终止的字符串

如何获取导致GraphQLError的文件名:语法错误:未终止的字符串,graphql,Graphql,在我们的团队中,在修改模式时,有时会出现GraphQl语法错误 但是,我们似乎没有得到导致问题的文件名?错误如下所示: GraphQLError: Syntax Error: Unterminated string. at syntaxError (<full-path-to-project>>node_modules/graphql/error/syntaxError.js:15:10) at readString (<full-path-to-proj

在我们的团队中,在修改模式时,有时会出现GraphQl语法错误

但是,我们似乎没有得到导致问题的文件名?错误如下所示:

GraphQLError: Syntax Error: Unterminated string.
    at syntaxError (<full-path-to-project>>node_modules/graphql/error/syntaxError.js:15:10)
    at readString (<full-path-to-project>>node_modules/graphql/language/lexer.js:513:38)
    at readToken (<full-path-to-project>>node_modules/graphql/language/lexer.js:267:14)
    at Object.lookahead (<full-path-to-project>>node_modules/graphql/language/lexer.js:54:43)
    at Object.advanceLexer [as advance] (<full-path-to-project>>node_modules/graphql/language/lexer.js:44:33)
    at Parser.parseStringLiteral (<full-path-to-project>>node_modules/graphql/language/parser.js:519:17)
    at Parser.parseDescription (<full-path-to-project>>node_modules/graphql/language/parser.js:728:19)
    at Parser.parseFieldDefinition (<full-path-to-project>>node_modules/graphql/language/parser.js:856:28)
    at Parser.optionalMany (<full-path-to-project>>node_modules/graphql/language/parser.js:1497:28)
    at Parser.parseFieldsDefinition (<full-path-to-project>>node_modules/graphql/language/parser.js:846:17)
    at Parser.parseObjectTypeDefinition (<full-path-to-project>>node_modules/graphql/language/parser.js:798:23)
    at Parser.parseTypeSystemDefinition (<full-path-to-project>>node_modules/graphql/language/parser.js:696:23)
    at Parser.parseDefinition (<full-path-to-project>>node_modules/graphql/language/parser.js:146:23)
    at Parser.many (<full-path-to-project>>node_modules/graphql/language/parser.js:1518:26)
    at Parser.parseDocument (<full-path-to-project>>node_modules/graphql/language/parser.js:111:25)
    at parse (<full-path-to-project>>node_modules/graphql/language/parser.js:36:17) {
  message: 'Syntax Error: Unterminated string.',
  locations: [ { line: 27, column: 51 } ]
}
GraphQLError:语法错误:未终止的字符串。
在syntaxError(>node_modules/graphql/error/syntaxError.js:15:10)
在readString(>node_modules/graphql/language/lexer.js:513:38)
在readToken(>node_modules/graphql/language/lexer.js:267:14)
在Object.lookahead(>node_modules/graphql/language/lexer.js:54:43)
在Object.advanceLexer[as advance](>node_modules/graphql/language/lexer.js:44:33)
在Parser.parseStringLiteral(>node_modules/graphql/language/Parser.js:519:17)
在Parser.parseDescription(>node_modules/graphql/language/Parser.js:728:19)
在Parser.parseFieldDefinition(>node_modules/graphql/language/Parser.js:856:28)
在Parser.optionalMany(>node_modules/graphql/language/Parser.js:1497:28)
在Parser.parsefields定义(>node_modules/graphql/language/Parser.js:846:17)
在Parser.parseObjectTypeDefinition(>node_modules/graphql/language/Parser.js:798:23)
在Parser.parseTypeSystemDefinition(>node_modules/graphql/language/Parser.js:696:23)
在Parser.parseDefinition(>node_modules/graphql/language/Parser.js:146:23)
在Parser.many(>node_modules/graphql/language/Parser.js:1518:26)
在Parser.parseDocument(>node_modules/graphql/language/Parser.js:111:25)
在parse(>node_modules/graphql/language/parser.js:36:17){
消息:“语法错误:未终止的字符串。”,
位置:[{行:27,列:51}]
}

这是否正常?如何获取导致问题的文件?

如果将架构拆分为多个文件,则没有好的方法检查错误的来源。检查自上次提交以来发生的任何更改,并查看第27行的语法错误。您还发现,使用编辑器插件为GraphQL文件提供语法高亮显示也很有帮助(VS代码有一个,我认为IntelliJ也有一个,可能还有其他的)。遗憾的是,在当前版本中,这是不可能的。最后,由于我没有编译我的typescript文件,所以产生了错误。您也可以尝试延长堆栈跟踪。这是否有效取决于合并模式文件的方式。