Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/elixir/lib/exception.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2718,7 +2718,7 @@ defmodule ErlangError do
{:ok, reason, IO.iodata_to_binary([":\n\n" | Enum.map(args_errors, &arg_error/1)])}

general = extra[:general] ->
{:ok, reason, ": " <> general}
{:ok, reason, ": " <> IO.chardata_to_string(general)}

true ->
:error
Expand Down
13 changes: 13 additions & 0 deletions lib/elixir/test/elixir/exception_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ defmodule ExceptionTest do
{:io, :put_chars, [self(), <<222>>],
[error_info: %{module: __MODULE__, function: :dummy_error_extras}]}
])

assert %ErlangError{
original: {:failed_load_cacerts, :enoent},
reason: ": Failed to load cacerts: operating system CA bundle could not be located"
} =
Exception.normalize(:error, {:failed_load_cacerts, :enoent}, [
{:pubkey_os_cacerts, :get, 0,
[
file: ~c"pubkey_os_cacerts.erl",
line: 53,
error_info: %{cause: :enoent, module: :pubkey_os_cacerts}
]}
])
Copy link
Member

Choose a reason for hiding this comment

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

Given this will depend on the Erlang/OTP version, I wonder if we should write our own Erlang error that reproduces the failure?

Copy link
Contributor Author

@sabiwara sabiwara Mar 15, 2025

Choose a reason for hiding this comment

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

Woops right, there was an example just above reused the same approach: 39ea53e

end

test "format/2 without stacktrace" do
Expand Down
Loading