Skip to content

Commit a07685a

Browse files
Merge pull request #206 from getsentry/fix-filters-and-mix-tasks
Fix filters and test mix task
2 parents 705e385 + 6671737 commit a07685a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lib/mix/tasks/sentry.send_test_event.ex

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ defmodule Mix.Tasks.Sentry.SendTestEvent do
77
Send test even to check if Sentry configuration is correct.
88
"""
99

10-
def run(_args) do
10+
def run(args) do
11+
unless "--no-compile" in args do
12+
Mix.Project.compile(args)
13+
end
14+
1115
Application.ensure_all_started(:sentry)
1216

1317
Sentry.Client.get_dsn!
1418
|> print_environment_info()
1519

20+
1621
maybe_send_event()
1722
end
1823

@@ -41,11 +46,17 @@ defmodule Mix.Tasks.Sentry.SendTestEvent do
4146
if env_name in included_envs do
4247
Mix.shell.info "Sending test event..."
4348

44-
{:ok, id} = "Testing sending Sentry event"
49+
result = "Testing sending Sentry event"
4550
|> RuntimeError.exception
4651
|> Sentry.capture_exception(result: :sync)
4752

48-
Mix.shell.info "Test event sent! Event ID: #{id}"
53+
case result do
54+
{:ok, id} ->
55+
Mix.shell.info "Test event sent! Event ID: #{id}"
56+
:excluded ->
57+
Mix.shell.info "No test event was sent because the event was excluded by a filter"
58+
end
59+
4960
else
5061
Mix.shell.info "#{inspect env_name} is not in #{inspect included_envs} so no test event will be sent"
5162
end

0 commit comments

Comments
 (0)