【发布时间】:2017-10-23 04:15:51
【问题描述】:
我怎样才能返回多个这样的错误消息?
"errors": [
{
"message": "first error",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"somePath"
]
},
{
"message": "second error",
"locations": [
{
"line": 8,
"column": 9
}
],
"path": [
"somePath"
]
},
]
在我的服务器上,如果我执行throw('an error'),它会返回。
"errors": [
{
"message": "an error",
"locations": [
{
}
],
"path": ["somePath"]
}
]
我想返回查询中所有错误的数组。
如何向errors 数组添加多个错误?
【问题讨论】:
-
你在这方面找到什么了吗?
-
没有一段时间没有在graphQL上工作过。