You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ErrValueError: "Field '$1' cannot be resolved: \"$2\""% [msg[0], msg[1]]
get they type after a RespResult holding a message string and the place where they're occur.
Comparing the situation to other GraphQL implementations, I'm wondering if there's a way to provide custom error messages ?
Perhaps raising an other exception when an unspecified error kind is met,
and adding a custom one with no formatting along the lines ?
Also, is it possible to stack them in a sequence before returning ?
I tried with ctx.errors.add but this is a user context, not the calling one (if that makes sense, but I'm still building the mental picture of the mechanisms). If not I would gladly PR on that.
The text was updated successfully, but these errors were encountered:
if you need custom error message, a possible alternative is using object variant to replace the string.
typeRespErrorType*=enumSimpleMsg# formatting handled by executorCustomMsg# formatting done by userListMsg# return one or more error messages
etc.
RespError=objectcase typ*: RespErrorType ofSimpleMsg: msg*: string ofCustomMsg: customMsg*: string ofListMsg: listMsg*: seq[stringor errorobject]
etc.
RespResult*=Result[Node, RespError]
then you need to overload err to provide backward compatible helper proc.
the rest is quite straight forward modification in executeField of executor.nim.
But if you have other solution, we can discuss it further.
Errors raised in a resolver — let's take
get they type after a
RespResult
holding a message string and the place where they're occur.Comparing the situation to other GraphQL implementations, I'm wondering if there's a way to provide custom error messages ?
Perhaps raising an other exception when an unspecified error kind is met,
and adding a custom one with no formatting along the lines ?
nim-graphql/graphql/graphql.nim
Line 260 in 4f98887
Also, is it possible to stack them in a sequence before returning ?
I tried with
ctx.errors.add
but this is a user context, not the calling one (if that makes sense, but I'm still building the mental picture of the mechanisms). If not I would gladly PR on that.The text was updated successfully, but these errors were encountered: