Skip to content

Commit

Permalink
fix: properly display unknown vs required option for missing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Sep 12, 2024
1 parent 58cad59 commit fbbf932
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/spark/options/options.ex
Original file line number Diff line number Diff line change
Expand Up @@ -811,16 +811,16 @@ defmodule Spark.Options do
:error ->
if Keyword.get(schema, :required, false) do
error_tuple(
[key],
key,
nil,
"unknown options #{inspect([key])}, valid options are: #{inspect(Keyword.keys(schema))}"
"required #{render_key(key)} not found, received options: " <>
inspect(Keyword.keys(opts))
)
else
error_tuple(
key,
[key],
nil,
"required #{render_key(key)} not found, received options: " <>
inspect(Keyword.keys(opts))
"unknown options #{inspect([key])}, valid options are: #{inspect(Keyword.keys(schema))}"
)
end

Expand Down

0 comments on commit fbbf932

Please sign in to comment.