Skip to content

Crash when formatting message for TokenMissingError in heex tempate #13199

@lukaszsamson

Description

@lukaszsamson

Elixir and Erlang/OTP versions

Erlang/OTP 25 [erts-13.2.2.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1]

Elixir 1.16.0-rc.1 (28f8eba) (compiled with Erlang/OTP 25)

Operating system

macOS

Current behavior

  <li>
    <strong>Public ID:</strong>
    <%= @some.field.public_id[ %>
  </li>
== Compilation error in file lib/some/views/some_view.ex ==
** (TokenMissingError) got ArgumentError with message "errors were found at the given arguments:\n\n  * 2nd argument: out of range\n" while retrieving Exception.message/1 for %TokenMissingError{file: "lib/some/templates/some/show.html.heex", line: 3, column: 30, end_line: 3, end_column: 32, line_offset: 2, snippet: " @some.field.public_id[ ", opening_delimiter: :"[", expected_delimiter: :"]", description: "missing terminator: ]"}. Stacktrace:
    (stdlib 4.3.1.3) :binary.copy(" ", -6)
    (elixir 1.16.0-rc.1) lib/exception.ex:907: Exception.n_spaces/1
    (elixir 1.16.0-rc.1) lib/exception.ex:993: Exception.format_end_message/2
    (elixir 1.16.0-rc.1) lib/exception.ex:876: Exception.format_snippet/8
    (elixir 1.16.0-rc.1) lib/exception.ex:1344: TokenMissingError.message/1
    (elixir 1.16.0-rc.1) lib/exception.ex:64: Exception.message/1
    (elixir 1.16.0-rc.1) lib/exception.ex:115: Exception.format_banner/3
    (elixir 1.16.0-rc.1) lib/kernel/cli.ex:107: Kernel.CLI.format_error/3
    (elixir 1.16.0-rc.1) lib/kernel/parallel_compiler.ex:888: Kernel.ParallelCompiler.print_error/4
    (elixir 1.16.0-rc.1) lib/kernel/parallel_compiler.ex:709: Kernel.ParallelCompiler.wait_for_messages/8
    (elixir 1.16.0-rc.1) lib/kernel/parallel_compiler.ex:291: Kernel.ParallelCompiler.spawn_workers/5
    (elixir 1.16.0-rc.1) lib/kernel/parallel_compiler.ex:246: Kernel.ParallelCompiler.spawn_workers/3
    (mix 1.16.0-rc.1) lib/mix/compilers/elixir.ex:1013: anonymous fn/9 in Mix.Compilers.Elixir.compiler_loop/6

    (eex 1.16.0-rc.1) lib/eex/compiler.ex:332: EEx.Compiler.generate_buffer/4
    (phoenix_live_view 0.18.18) expanding macro: Phoenix.LiveView.HTMLEngine.compile/1
    /some/apps/some/lib/some/views/some_view.ex:1: (file)
    (phoenix_view 2.0.2) /some/apps/some/lib/some/views/some_view.ex:1: Phoenix.View.__before_compile__/1

Expected behavior

Normal error message

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions