graphql

ghaskins 2025-12-31T20:49:18.558819Z

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?

ghaskins 2025-12-31T20:51:25.625239Z

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

ghaskins 2025-12-31T20:51:47.595399Z

(in this case, my schema was wrong, but id like to at least log this server side)

Alex 2026-01-05T12:40:05.074929Z

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 + ...

👍 1