Commit 3b6eb54 1 parent 13c56b1 commit 3b6eb54 Copy full SHA for 3b6eb54
File tree 6 files changed +22
-78
lines changed
6 files changed +22
-78
lines changed Original file line number Diff line number Diff line change @@ -186,27 +186,12 @@ def send_config(env, &block)
186
186
# Extensions for HTTP API Instance
187
187
module Instance
188
188
def send_config ( env )
189
- raise ConfigNotSupportedError , spec unless spec . is_a? ( Config ::API ::Spec )
189
+ raise Core :: Transport :: HTTP :: API :: Instance :: EndpointNotSupportedError . new ( self , 'config' ) unless spec . is_a? ( Config ::API ::Spec )
190
190
191
191
spec . send_config ( env ) do |request_env |
192
192
call ( request_env )
193
193
end
194
194
end
195
-
196
- # Raised when traces sent to API that does not support traces
197
- class ConfigNotSupportedError < StandardError
198
- attr_reader :spec
199
-
200
- def initialize ( spec )
201
- super ( )
202
-
203
- @spec = spec
204
- end
205
-
206
- def message
207
- 'Config not supported for this API!'
208
- end
209
- end
210
195
end
211
196
212
197
# Endpoint for remote configuration
Original file line number Diff line number Diff line change @@ -59,27 +59,12 @@ def send_info(env, &block)
59
59
# Extensions for HTTP API Instance
60
60
module Instance
61
61
def send_info ( env )
62
- raise NegotiationNotSupportedError , spec unless spec . is_a? ( Negotiation ::API ::Spec )
62
+ raise Core :: Transport :: HTTP :: API :: Instance :: EndpointNotSupportedError . new ( self , 'info' ) unless spec . is_a? ( Negotiation ::API ::Spec )
63
63
64
64
spec . send_info ( env ) do |request_env |
65
65
call ( request_env )
66
66
end
67
67
end
68
-
69
- # Raised when traces sent to API that does not support traces
70
- class NegotiationNotSupportedError < StandardError
71
- attr_reader :spec
72
-
73
- def initialize ( spec )
74
- super ( )
75
-
76
- @spec = spec
77
- end
78
-
79
- def message
80
- 'Info not supported for this API!'
81
- end
82
- end
83
68
end
84
69
85
70
# Endpoint for negotiation
Original file line number Diff line number Diff line change @@ -7,6 +7,23 @@ module HTTP
7
7
module API
8
8
# An API configured with adapter and routes
9
9
class Instance
10
+
11
+ class EndpointNotSupportedError < StandardError
12
+ attr_reader :spec
13
+ attr_reader :endpoint_name
14
+
15
+ def initialize ( spec , endpoint_name )
16
+ @spec = spec
17
+ @endpoint_name = endpoint_name
18
+
19
+ super ( message )
20
+ end
21
+
22
+ def message
23
+ "#{ endpoin_name } not supported for this API!"
24
+ end
25
+ end
26
+
10
27
attr_reader \
11
28
:adapter ,
12
29
:headers ,
Original file line number Diff line number Diff line change @@ -18,26 +18,12 @@ def send_diagnostics_payload(request)
18
18
module API
19
19
module Instance
20
20
def send_diagnostics ( env )
21
- raise DiagnosticsNotSupportedError , spec unless spec . is_a? ( Diagnostics ::API ::Spec )
21
+ raise Core :: Transport :: HTTP :: API :: Instance :: EndpointNotSupportedError . new ( self , 'diagnostics' ) unless spec . is_a? ( Diagnostics ::API ::Spec )
22
22
23
23
spec . send_diagnostics ( env ) do |request_env |
24
24
call ( request_env )
25
25
end
26
26
end
27
-
28
- class DiagnosticsNotSupportedError < StandardError
29
- attr_reader :spec
30
-
31
- def initialize ( spec )
32
- super
33
-
34
- @spec = spec
35
- end
36
-
37
- def message
38
- 'Diagnostics not supported for this API!'
39
- end
40
- end
41
27
end
42
28
43
29
module Spec
Original file line number Diff line number Diff line change @@ -18,26 +18,12 @@ def send_input_payload(request)
18
18
module API
19
19
module Instance
20
20
def send_input ( env )
21
- raise InputNotSupportedError , spec unless spec . is_a? ( Input ::API ::Spec )
21
+ raise Core :: Transport :: HTTP :: API :: Instance :: EndpointNotSupportedError . new ( self , 'input' ) unless spec . is_a? ( Input ::API ::Spec )
22
22
23
23
spec . send_input ( env ) do |request_env |
24
24
call ( request_env )
25
25
end
26
26
end
27
-
28
- class InputNotSupportedError < StandardError
29
- attr_reader :spec
30
-
31
- def initialize ( spec )
32
- super
33
-
34
- @spec = spec
35
- end
36
-
37
- def message
38
- 'Input not supported for this API!'
39
- end
40
- end
41
27
end
42
28
43
29
module Spec
Original file line number Diff line number Diff line change @@ -57,27 +57,12 @@ def encoder
57
57
# Extensions for HTTP API Instance
58
58
module Instance
59
59
def send_traces ( env )
60
- raise TracesNotSupportedError , spec unless spec . is_a? ( Traces ::API ::Spec )
60
+ raise Core :: Transport :: HTTP :: API :: Instance :: EndpointNotSupportedError . new ( self , 'traces' ) unless spec . is_a? ( Traces ::API ::Spec )
61
61
62
62
spec . send_traces ( env ) do |request_env |
63
63
call ( request_env )
64
64
end
65
65
end
66
-
67
- # Raised when traces sent to API that does not support traces
68
- class TracesNotSupportedError < StandardError
69
- attr_reader :spec
70
-
71
- def initialize ( spec )
72
- super
73
-
74
- @spec = spec
75
- end
76
-
77
- def message
78
- 'Traces not supported for this API!'
79
- end
80
- end
81
66
end
82
67
83
68
# Endpoint for submitting trace data
You can’t perform that action at this time.
0 commit comments