Class: TwirpRails::ErrorHandling::Base::ExceptionHandler

Inherits:
Struct
  • Object
show all
Defined in:
lib/twirp_rails/error_handling/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exceptionObject

Returns the value of attribute exception

Returns:

  • (Object)

    the current value of exception



6
7
8
# File 'lib/twirp_rails/error_handling/base.rb', line 6

def exception
  @exception
end

#procObject

Returns the value of attribute proc

Returns:

  • (Object)

    the current value of proc



6
7
8
# File 'lib/twirp_rails/error_handling/base.rb', line 6

def proc
  @proc
end

Instance Method Details

#handle(exception, handler) ⇒ Object



11
12
13
# File 'lib/twirp_rails/error_handling/base.rb', line 11

def handle(exception, handler)
  proc.call(exception, handler)
end

#match?(exception) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/twirp_rails/error_handling/base.rb', line 7

def match?(exception)
  exception.is_a?(self.exception)
end

#process(exception, handler) ⇒ Object



15
16
17
# File 'lib/twirp_rails/error_handling/base.rb', line 15

def process(exception, handler)
  match?(exception) ? handle(exception, handler) : nil
end