Skip to content

Commit

Permalink
Fix Dialyzer issues
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Sep 20, 2023
1 parent 48cf37d commit 43b7783
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/sentry/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ defmodule Sentry.Config do
def validate_included_environments! do
normalized_environments =
case included_environments() do
comma_separated_envs when is_binary(comma_separated_envs) ->
IO.warn("""
setting :included_environments to a comma-separated string is deprecated and won't \
be supported in the next major version. Set :included_environments to a list of \
atoms instead.\
""")

String.split(comma_separated_envs, ",")

list when is_list(list) ->
Enum.map(list, fn
env when is_atom(env) or is_binary(env) ->
Expand Down Expand Up @@ -114,6 +105,12 @@ defmodule Sentry.Config do
{:ok, :all} ->
:all

{:ok, envs} when is_binary(envs) ->
raise ArgumentError, """
setting :included_environments to a comma-separated string is not supported anymore. \
Set :included_environments to a list of atoms instead.\
"""

{:ok, envs} when is_list(envs) ->
string_envs = Enum.map(envs, &to_string/1)
Application.put_env(:sentry, :included_environments, string_envs)
Expand Down
1 change: 1 addition & 0 deletions test/config_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ defmodule Sentry.ConfigTest do
test "raises if not set" do

Check failure on line 59 in test/config_test.exs

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.11.4, OTP 21.3)

test environment_name/0 raises if not set (Sentry.ConfigTest)
assert_raise RuntimeError, ~r/:environment_name must be set/, fn ->
modify_env(:sentry, environment_name: nil)
modify_system_env(%{"SENTRY_ENVIRONMENT" => nil})
Config.environment_name()
end
end
Expand Down

0 comments on commit 43b7783

Please sign in to comment.