File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed
Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,21 @@ defmodule Sentry do
101101 Config . client ( ) . child_spec ( )
102102 ]
103103
104+ if Config . client ( ) == Sentry.HackneyClient do
105+ unless Code . ensure_loaded? ( :hackney ) do
106+ raise """
107+ cannot start the :sentry application because the HTTP client is set to \
108+ Sentry.HackneyClient (which is the default), but the Hackney library is not loaded. \
109+ Add :hackney to your dependencies to fix this.
110+ """
111+ end
112+
113+ case Application . ensure_all_started ( :hackney ) do
114+ { :ok , _apps } -> :ok
115+ { :error , reason } -> raise "failed to start the :hackney application: #{ inspect ( reason ) } "
116+ end
117+ end
118+
104119 validate_json_config! ( )
105120 validate_log_level_config! ( )
106121
Original file line number Diff line number Diff line change @@ -7,25 +7,16 @@ defmodule Sentry.HackneyClient do
77
88 @ hackney_pool_name :sentry_pool
99
10+ @ impl true
1011 def child_spec do
11- unless Code . ensure_loaded? ( :hackney ) do
12- raise """
13- cannot start Sentry.HackneyClient because :hackney is not available.
14- Please make sure to add hackney as a dependency:
15-
16- {:hackney, "~> 1.8"}
17- """
18- end
19-
20- Application . ensure_all_started ( :hackney )
21-
2212 :hackney_pool . child_spec (
2313 @ hackney_pool_name ,
2414 timeout: Sentry.Config . hackney_timeout ( ) ,
2515 max_connections: Sentry.Config . max_hackney_connections ( )
2616 )
2717 end
2818
19+ @ impl true
2920 def post ( url , headers , body ) do
3021 hackney_opts =
3122 Sentry.Config . hackney_opts ( )
You can’t perform that action at this time.
0 commit comments