Skip to content

Commit 43906ac

Browse files
committed
default result type to :none
1 parent dfcbf23 commit 43906ac

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/sentry/client.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ defmodule Sentry.Client do
5656
The event is dropped if it all retries fail.
5757
5858
### Options
59-
* `:result` - Allows specifying how the result should be returned. Options include `:sync`, `:none`, and `:async`. `:sync` will make the API call synchronously, and return `{:ok, event_id}` if successful. `:none` sends the event from an unlinked child process under `Sentry.TaskSupervisor` and will return `{:ok, ""}` regardless of the result. `:async` will start an unlinked task and return a tuple of `{:ok, Task.t}` on success where the Task can be awaited upon to receive the result asynchronously. When used in an OTP behaviour like GenServer, the task will send a message that needs to be matched with `GenServer.handle_info/2`. See `Task.Supervisor.async_nolink/2` for more information. `:async` is the default.
59+
* `:result` - Allows specifying how the result should be returned. Options include `:sync`, `:none`, and `:async`. `:sync` will make the API call synchronously, and return `{:ok, event_id}` if successful. `:none` sends the event from an unlinked child process under `Sentry.TaskSupervisor` and will return `{:ok, ""}` regardless of the result. `:async` will start an unlinked task and return a tuple of `{:ok, Task.t}` on success where the Task should be awaited upon to receive the result asynchronously. If you do not call `Task.await/2`, messages will be leaked to the inbox of the current process. See `Task.Supervisor.async_nolink/2` for more information. `:none` is the default.
6060
* `:sample_rate` - The sampling factor to apply to events. A value of 0.0 will deny sending any events, and a value of 1.0 will send 100% of events.
6161
"""
6262
@spec send_event(Event.t()) :: send_event_result
6363
def send_event(%Event{} = event, opts \\ []) do
64-
result = Keyword.get(opts, :result, :async)
64+
result = Keyword.get(opts, :result, :none)
6565
sample_rate = Keyword.get(opts, :sample_rate) || Config.sample_rate()
6666

6767
event = maybe_call_before_send_event(event)

test/client_test.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ defmodule Sentry.ClientTest do
327327
{:ok, task} =
328328
Sentry.capture_exception(
329329
e,
330-
stacktrace: __STACKTRACE__
330+
stacktrace: __STACKTRACE__,
331+
result: :async
331332
)
332333

333334
assert_receive "API called"

0 commit comments

Comments
 (0)