From 43b77836352dd3f02a155c69fa932d02a4d94a0a Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Wed, 20 Sep 2023 19:55:11 +0200 Subject: [PATCH] Fix Dialyzer issues --- lib/sentry/config.ex | 15 ++++++--------- test/config_test.exs | 1 + 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/sentry/config.ex b/lib/sentry/config.ex index 149ee32b..65b7e3f7 100644 --- a/lib/sentry/config.ex +++ b/lib/sentry/config.ex @@ -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) -> @@ -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) diff --git a/test/config_test.exs b/test/config_test.exs index 54ddb157..029273b9 100644 --- a/test/config_test.exs +++ b/test/config_test.exs @@ -59,6 +59,7 @@ defmodule Sentry.ConfigTest do test "raises if not set" do 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