• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ExWeb3 / elixir_ethers / f9961fe87cc87db4c5c39b0825db6cfb995ee69c

30 May 2024 01:27AM UTC coverage: 93.548% (-0.1%) from 93.657%
f9961fe87cc87db4c5c39b0825db6cfb995ee69c

push

github

web-flow
Handle unexpected errors in ExectionError exceptions (#126)

3 of 4 new or added lines in 1 file covered. (75.0%)

754 of 806 relevant lines covered (93.55%)

30.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/lib/ethers/execution_error.ex
1
defmodule Ethers.ExecutionError do
2
  @moduledoc """
3
  Execution Error Exception.
4

5
  The Exception struct will have these values:
6

7
  - `message`: Human readable error message
8
  - `evm_error`: A custom error from the contract. (An Error Struct)
9
  """
10

11
  defexception [:message, :evm_error]
12

13
  @impl true
14
  def exception(%{"code" => _} = evm_error) do
15
    %__MODULE__{
1✔
16
      message: Map.get(evm_error, "message", "unknown error!"),
17
      evm_error: evm_error
18
    }
19
  end
20

21
  def exception(error) when is_exception(error), do: error
1✔
22

23
  def exception(error) when is_struct(error) do
24
    %__MODULE__{message: inspect(error), evm_error: error}
1✔
25
  end
26

27
  def exception(error) do
28
    %__MODULE__{message: "Unexpected error: #{maybe_inspect_error(error)}"}
6✔
29
  end
30

31
  defp maybe_inspect_error(error) when is_atom(error), do: Atom.to_string(error)
6✔
NEW
32
  defp maybe_inspect_error(error), do: inspect(error)
×
33
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc