Module: Servus::Support::Rescuer::CallOverride Private

Defined in:
lib/servus/support/rescuer.rb

Overview

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

Wraps the service's .call method with error handling logic.

This module is prepended to the service's singleton class, allowing it to intercept calls and add rescue behavior before delegating to the original implementation.

Instance Method Summary collapse

Instance Method Details

#call(**args) ⇒ Servus::Support::Response

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.

Wraps the service call with automatic error rescue.

If rescuable_errors are configured, wraps the call in a rescue block. Caught exceptions are converted to failure responses using #handle_failure.

Parameters:

  • args (Hash)

    keyword arguments passed to the service

Returns:



153
154
155
156
157
158
159
160
161
# File 'lib/servus/support/rescuer.rb', line 153

def call(**args)
  return super if rescuable_configs.empty?

  begin
    super
  rescue StandardError => e
    handle_rescued_error(e) || raise
  end
end