diff --git a/config/config.exs b/config/config.exs index 3d1c8b2..ff1b64f 100644 --- a/config/config.exs +++ b/config/config.exs @@ -46,7 +46,7 @@ config :ex_aws, http_client: ExAws.Request.Req, json_codec: JSON -config :sentry, client: Sentry.FinchClient +config :sentry, client: Hexdocs.SentryClient config :logger, :console, format: "[$level] $metadata$message\n" diff --git a/lib/hexdocs/sentry_client.ex b/lib/hexdocs/sentry_client.ex new file mode 100644 index 0000000..578a527 --- /dev/null +++ b/lib/hexdocs/sentry_client.ex @@ -0,0 +1,21 @@ +defmodule Hexdocs.SentryClient do + @behaviour Sentry.HTTPClient + + @impl true + def child_spec do + Supervisor.child_spec({Finch, name: __MODULE__}, id: __MODULE__) + end + + @impl true + def post(url, headers, body) do + request = Finch.build(:post, url, headers, body) + + case Finch.request(request, __MODULE__) do + {:ok, %Finch.Response{status: status, headers: headers, body: body}} -> + {:ok, status, headers, body} + + {:error, error} -> + {:error, error} + end + end +end diff --git a/lib/hexdocs/store/store.ex b/lib/hexdocs/store/store.ex index 2cda2ac..b07a2d7 100644 --- a/lib/hexdocs/store/store.ex +++ b/lib/hexdocs/store/store.ex @@ -15,7 +15,6 @@ defmodule Hexdocs.Store do @type opts :: Keyword.t() @callback get(bucket, key, opts) :: body | nil - @callback list(bucket, prefix) :: [key] end defmodule Docs do