class TwirpRails::ErrorHandlingFactory::HandlerProxy
Attributes
handler[R]
translator_class[R]
Public Class Methods
new(handler, translator_class)
click to toggle source
# File lib/twirp_rails/error_handling/error_handling_factory.rb, line 6 def initialize(handler, translator_class) @handler = handler @translator_class = translator_class end
Public Instance Methods
method_missing(method, *args)
click to toggle source
rubocop:disable Style/MethodMissingSuper
# File lib/twirp_rails/error_handling/error_handling_factory.rb, line 12 def method_missing(method, *args) handler.public_send method, *args rescue => e if ENV['RAISE_TWIRP_ERRORS'].present? raise e else Rails.logger.warn("Muted error: #{e.message}") Rails.logger.warn("Muted error: #{e.full_message}") Rails.logger.warn('Enable raise with RAISE_TWIRP_ERRORS env variable') end translator_class.exception_to_twirp(e, handler) end
respond_to_missing?(method, include_all = false)
click to toggle source
rubocop:enable Style/MethodMissingSuper
# File lib/twirp_rails/error_handling/error_handling_factory.rb, line 27 def respond_to_missing?(method, include_all = false) handler.respond_to?(method, include_all) end