File tree Expand file tree Collapse file tree 6 files changed +22
-78
lines changed
Expand file tree Collapse file tree 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)
186186 # Extensions for HTTP API Instance
187187 module Instance
188188 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 )
190190
191191 spec . send_config ( env ) do |request_env |
192192 call ( request_env )
193193 end
194194 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
210195 end
211196
212197 # Endpoint for remote configuration
Original file line number Diff line number Diff line change @@ -59,27 +59,12 @@ def send_info(env, &block)
5959 # Extensions for HTTP API Instance
6060 module Instance
6161 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 )
6363
6464 spec . send_info ( env ) do |request_env |
6565 call ( request_env )
6666 end
6767 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
8368 end
8469
8570 # Endpoint for negotiation
Original file line number Diff line number Diff line change @@ -7,6 +7,23 @@ module HTTP
77 module API
88 # An API configured with adapter and routes
99 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+
1027 attr_reader \
1128 :adapter ,
1229 :headers ,
Original file line number Diff line number Diff line change @@ -18,26 +18,12 @@ def send_diagnostics_payload(request)
1818 module API
1919 module Instance
2020 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 )
2222
2323 spec . send_diagnostics ( env ) do |request_env |
2424 call ( request_env )
2525 end
2626 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
4127 end
4228
4329 module Spec
Original file line number Diff line number Diff line change @@ -18,26 +18,12 @@ def send_input_payload(request)
1818 module API
1919 module Instance
2020 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 )
2222
2323 spec . send_input ( env ) do |request_env |
2424 call ( request_env )
2525 end
2626 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
4127 end
4228
4329 module Spec
Original file line number Diff line number Diff line change @@ -57,27 +57,12 @@ def encoder
5757 # Extensions for HTTP API Instance
5858 module Instance
5959 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 )
6161
6262 spec . send_traces ( env ) do |request_env |
6363 call ( request_env )
6464 end
6565 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
8166 end
8267
8368 # Endpoint for submitting trace data
You can’t perform that action at this time.
0 commit comments