Class: CC::Service::Invocation::WithErrorHandling
- Inherits:
-
Object
- Object
- CC::Service::Invocation::WithErrorHandling
- Defined in:
- lib/cc/service/invocation/with_error_handling.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(invocation, logger, prefix = nil) ⇒ WithErrorHandling
constructor
A new instance of WithErrorHandling.
Constructor Details
#initialize(invocation, logger, prefix = nil) ⇒ WithErrorHandling
Returns a new instance of WithErrorHandling.
3 4 5 6 7 |
# File 'lib/cc/service/invocation/with_error_handling.rb', line 3 def initialize(invocation, logger, prefix = nil) @invocation = invocation @logger = logger @prefix = prefix end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cc/service/invocation/with_error_handling.rb', line 9 def call @invocation.call rescue CC::Service::HTTPError => e @logger.error((e)) { ok: false, params: e.params, status: e.status, endpoint_url: e.endpoint_url, message: e. || e., log_message: (e), } rescue => e @logger.error((e)) { ok: false, message: e., log_message: (e), } end |