Happy New Year (almost) all. I had a question related to field-resolver errors. I just found a bug where an illegal enum value was returned by a field resolver, which the lacinia layer then pukes on and returns an error to the client. Here is a partial snippet of what the client sees:
:errors [{:message "Field resolver returned an undefined enum value.",
:locations [{:line 1, :column 216}],
:path ["accesslog" "records" 12 "references" 0 "reason"],
:extensions {:resolved-value "UNKNOWN_ERROR",
:serialized-value "UNKNOWN_ERROR",
:enum-values ["NETWORK_ERROR"
"COMPILATION_ERROR"
"POLICY_OUTCOME"
"UNKNOWN"
"NOTFOUND_ERROR"
"EVALUATION_ERROR"
"INVALIDPARAM_ERROR"]}}
This is super clear what is wrong: the resolver returned “UNKNOWN_ERROR,” whereas the schema expected “UNKNOWN”. My question is this: Is there a way I could have logged this on the server side?I was poking around in https://lacinia.readthedocs.io/en/latest/resolve/resolve-as.html#using-resolverresult but its not clear that this the right mechanism, as my resolver didnt catch the issue, the lacinia-schema layer did
(in this case, my schema was wrong, but id like to at least log this server side)
Hi.
In my current project, we added an error-‘humanization’ layer and logging between the server response and lacinia/execute, based on the data returned in :extensions/…. In your case, you could log whenever :enum-values appears in :extensions + ...