Skip to content

Commit

Permalink
refactor: updates tower
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed Oct 4, 2024
1 parent 5d9ad2a commit 99c17b2
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 24 deletions.
17 changes: 2 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,7 @@ end

## Usage

First, attach `Tower` to automatically capture errors.

```elixir
# lib/<your_app>/application.ex

defmodule YourApp.Application do
def start(_type, _args) do
Tower.attach()

# rest of your code
end
```

Then tell `Tower` to inform `TowerHoneybadger` reporter about them.
Tell `Tower` to inform `TowerHoneybadger` reporter about errors.

```elixir
# config/config.exs
Expand All @@ -50,7 +37,7 @@ config(
)
```

And finally configure `:tower_honeybadger`, with at least the API key.
And configure `:tower_honeybadger`, with at least the API key.

```elixir
# config/runtime.exs
Expand Down
2 changes: 1 addition & 1 deletion blend/plug_1_14.mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"plug_crypto": {:hex, :plug_crypto, "1.2.5", "918772575e48e81e455818229bf719d4ab4181fcbf7f85b68a35620f78d89ced", [:mix], [], "hexpm", "26549a1d6345e2172eb1c233866756ae44a9609bd33ee6f99147ab3fd87fd842"},
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
"tower": {:hex, :tower, "0.5.3", "55f1c34ea2a9b057fa5386fb05fd54cdf9ef866c0bfab054716db87f32f76b94", [:mix], [{:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}, {:uniq, "~> 0.6.0", [hex: :uniq, repo: "hexpm", optional: false]}], "hexpm", "2ed7a79055315a8e222677d842894992fd7a830d96a3ea3d1985ede8e48bab7c"},
"tower": {:git, "https://github.com/mimiquate/tower.git", "fc866fca6d1c66a4cedd4f6e0f182c02009c269a", [tag: "v0.6.0"]},
"uniq": {:hex, :uniq, "0.6.1", "369660ecbc19051be526df3aa85dc393af5f61f45209bce2fa6d7adb051ae03c", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "6426c34d677054b3056947125b22e0daafd10367b85f349e24ac60f44effb916"},
}
2 changes: 1 addition & 1 deletion blend/plug_1_15.mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"},
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
"tower": {:hex, :tower, "0.5.3", "55f1c34ea2a9b057fa5386fb05fd54cdf9ef866c0bfab054716db87f32f76b94", [:mix], [{:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}, {:uniq, "~> 0.6.0", [hex: :uniq, repo: "hexpm", optional: false]}], "hexpm", "2ed7a79055315a8e222677d842894992fd7a830d96a3ea3d1985ede8e48bab7c"},
"tower": {:git, "https://github.com/mimiquate/tower.git", "fc866fca6d1c66a4cedd4f6e0f182c02009c269a", [tag: "v0.6.0"]},
"uniq": {:hex, :uniq, "0.6.1", "369660ecbc19051be526df3aa85dc393af5f61f45209bce2fa6d7adb051ae03c", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "6426c34d677054b3056947125b22e0daafd10367b85f349e24ac60f44effb916"},
}
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule TowerHoneybadger.MixProject do
defp deps do
[
{:jason, "~> 1.4"},
{:tower, "~> 0.5.0"},
{:tower, github: "mimiquate/tower", tag: "v0.6.0"},
{:plug, "~> 1.14"},

# Dev
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"},
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
"tower": {:hex, :tower, "0.5.3", "55f1c34ea2a9b057fa5386fb05fd54cdf9ef866c0bfab054716db87f32f76b94", [:mix], [{:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}, {:uniq, "~> 0.6.0", [hex: :uniq, repo: "hexpm", optional: false]}], "hexpm", "2ed7a79055315a8e222677d842894992fd7a830d96a3ea3d1985ede8e48bab7c"},
"tower": {:git, "https://github.com/mimiquate/tower.git", "fc866fca6d1c66a4cedd4f6e0f182c02009c269a", [tag: "v0.6.0"]},
"uniq": {:hex, :uniq, "0.6.1", "369660ecbc19051be526df3aa85dc393af5f61f45209bce2fa6d7adb051ae03c", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "6426c34d677054b3056947125b22e0daafd10367b85f349e24ac60f44effb916"},
}
8 changes: 3 additions & 5 deletions test/tower_honeybadger_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ defmodule TowerHoneybadgerTest do
Application.put_env(:tower_honeybadger, :api_key, "test-api-key")
Application.put_env(:tower_honeybadger, :environment, :test)
Application.put_env(:tower, :reporters, [TowerHoneybadger.Reporter])
Tower.attach()

on_exit(fn ->
Tower.detach()
Application.put_env(:tower_honeybadger, :api_key, nil)
Application.put_env(:tower_honeybadger, :environment, nil)
Application.put_env(:tower, :reporters, [])
Expand Down Expand Up @@ -54,7 +52,7 @@ defmodule TowerHoneybadgerTest do
"file" => "test/tower_honeybadger_test.exs",
"method" =>
~s(anonymous fn/0 in TowerHoneybadgerTest."test reports arithmetic error"/1),
"number" => 70
"number" => 68
} = List.first(backtrace_entries)
)

Expand Down Expand Up @@ -98,7 +96,7 @@ defmodule TowerHoneybadgerTest do
%{
"file" => "test/tower_honeybadger_test.exs",
"method" => ~s(anonymous fn/0 in TowerHoneybadgerTest."test reports throw"/1),
"number" => 114
"number" => 112
} = List.first(backtrace_entries)
)

Expand Down Expand Up @@ -142,7 +140,7 @@ defmodule TowerHoneybadgerTest do
%{
"file" => "test/tower_honeybadger_test.exs",
"method" => ~s(anonymous fn/0 in TowerHoneybadgerTest."test reports abnormal exit"/1),
"number" => 158
"number" => 156
} = List.first(backtrace_entries)
)

Expand Down

0 comments on commit 99c17b2

Please sign in to comment.