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
101
101
Config . client ( ) . child_spec ( )
102
102
]
103
103
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
+
104
119
validate_json_config! ( )
105
120
validate_log_level_config! ( )
106
121
Original file line number Diff line number Diff line change @@ -7,25 +7,16 @@ defmodule Sentry.HackneyClient do
7
7
8
8
@ hackney_pool_name :sentry_pool
9
9
10
+ @ impl true
10
11
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
-
22
12
:hackney_pool . child_spec (
23
13
@ hackney_pool_name ,
24
14
timeout: Sentry.Config . hackney_timeout ( ) ,
25
15
max_connections: Sentry.Config . max_hackney_connections ( )
26
16
)
27
17
end
28
18
19
+ @ impl true
29
20
def post ( url , headers , body ) do
30
21
hackney_opts =
31
22
Sentry.Config . hackney_opts ( )
You can’t perform that action at this time.
0 commit comments