Skip to content

Commit

Permalink
complexity errors to extensions.warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
1e16miin committed Aug 22, 2024
1 parent c360d04 commit 17f294e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/com/walmartlabs/lacinia.clj
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,16 @@

(seq validation-errors)
(resolve/resolve-as {:errors validation-errors})

:let [complexity-error (when (:max-complexity options)
(complexity-analysis/complexity-analysis prepared options))]

(some? complexity-error)
(resolve/resolve-as {:errors complexity-error})
:let [complexity-error (when (:max-complexity options)
(complexity-analysis/complexity-analysis prepared options))]

:else
(executor/execute-query (assoc context constants/parsed-query-key prepared
::tracing/validation {:start-offset start-offset
:duration (tracing/duration start-nanos)})))))
:else (executor/execute-query (assoc context constants/parsed-query-key prepared
:warnings (if complexity-error
(atom [complexity-error])
(atom []))
::tracing/validation {:start-offset start-offset
:duration (tracing/duration start-nanos)})))))

(defn execute-parsed-query
"Prepares a query, by applying query variables to it, resulting in a prepared
Expand All @@ -86,6 +85,7 @@
:or {timeout-ms 0
timeout-error {:message "Query execution timed out."}}} options
execution-result (execute-parsed-query-async parsed-query variables context options)
_ (prn execution-result)
result (do
(resolve/on-deliver! execution-result *result)
;; Block on that deliver, then return the final result.
Expand Down
2 changes: 1 addition & 1 deletion src/com/walmartlabs/lacinia/executor.clj
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
(binding [resolve/*callback-executor* executor]
(let [enabled-selections (remove :disabled? selections)
*errors (atom [])
*warnings (atom [])
*warnings (:warnings context)
*extensions (atom {})
*resolver-tracing (when (::tracing/enabled? context)
(atom []))
Expand Down

0 comments on commit 17f294e

Please sign in to comment.