Class: ConvenientService::Service::Plugins::CanHaveFallbacks::Middleware Private

Inherits:
MethodChainMiddleware
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/can_have_fallbacks/middleware.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0

Instance Method Summary collapse

Instance Method Details

#nextConvenientService::Service::Plugins::HasJSendResult::Entities::Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

Both fallback_failure_result, fallback_error_result and fallback_result are always successful, that is why their statuses are pre-checked.



20
21
22
23
24
25
26
# File 'lib/convenient_service/service/plugins/can_have_fallbacks/middleware.rb', line 20

def next(...)
  fallback_result = chain.next(...)

  ::ConvenientService.raise Exceptions::ServiceFallbackReturnValueNotSuccess.new(service: entity, result: fallback_result, status: status) unless fallback_result.success?

  fallback_result.copy(overrides: {kwargs: {method => true}}).tap(&:success?)
end