Skip to content

Fix inspect exception with ANSI enabled#148

Merged
whatyouhide merged 1 commit into
dashbitco:mainfrom
pnezis:inspect-error
Mar 12, 2026
Merged

Fix inspect exception with ANSI enabled#148
whatyouhide merged 1 commit into
dashbitco:mainfrom
pnezis:inspect-error

Conversation

@pnezis
Copy link
Copy Markdown
Contributor

@pnezis pnezis commented Mar 11, 2026

iex(1)> schema = [foo: [type: :integer]]
[foo: [type: :integer]]
iex(2)> NimbleOptions.validate([transformer: "test"], schema)
{:error,
 #Inspect.Error<
  got FunctionClauseError with message:

      """
      no function clause matching in :lists.do_flatten/2
      """

  while inspecting:

      %{
        message: "unknown options [:transformer], valid options are: [:foo]",
        value: nil,
        key: [:transformer],
        __struct__: NimbleOptions.ValidationError,
        __exception__: true,
        redact: false,
        keys_path: []
      }

  Stacktrace:

    (stdlib 7.3) lists.erl:1322: :lists.do_flatten({:doc_color, [], "\e[0m\e[33m"}, [])
    (stdlib 7.3) lists.erl:1325: :lists.do_flatten/2
    (stdlib 7.3) lists.erl:1323: :lists.do_flatten/2
    (nimble_options 1.1.1) lib/nimble_options/validation_error.ex:56: Inspect.NimbleOptions.ValidationError.inspect/2
    (elixir 1.19.3) lib/inspect/algebra.ex:401: Inspect.Algebra.to_doc_with_opts/2
    (elixir 1.19.3) lib/inspect/algebra.ex:613: Inspect.Algebra.call_container_fun/3
    (elixir 1.19.3) lib/inspect/algebra.ex:590: Inspect.Algebra.container_each/5
    (elixir 1.19.3) lib/inspect/algebra.ex:566: Inspect.Algebra.container_doc_with_opts/6

>}

Copy link
Copy Markdown
Collaborator

@whatyouhide whatyouhide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! Thank you.

@whatyouhide whatyouhide merged commit f16af25 into dashbitco:main Mar 12, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants