Class: Thrifter::ErrorWrapping

Inherits:
Object
  • Object
show all
Defined in:
lib/thrifter/middleware/error_wrapping.rb

Constant Summary collapse

WRAP =
[
  Thrift::TransportException,
  Thrift::ProtocolException,
  Thrift::ApplicationException,
  Timeout::Error,

  # This exception is a superclass for all Errno things coming
  # from the operating system network stack. See the documentation
  # on Error no for more information.
  SystemCallError
]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, extras = [ ]) ⇒ ErrorWrapping

Returns a new instance of ErrorWrapping.



21
22
23
# File 'lib/thrifter/middleware/error_wrapping.rb', line 21

def initialize(app, extras = [ ])
  @app, @extras = app, extras
end

Class Method Details

.wrappedObject



16
17
18
# File 'lib/thrifter/middleware/error_wrapping.rb', line 16

def wrapped
  WRAP
end

Instance Method Details

#call(rpc) ⇒ Object



25
26
27
28
29
# File 'lib/thrifter/middleware/error_wrapping.rb', line 25

def call(rpc)
  app.call rpc
rescue *wrapped => ex
  raise ClientError, ex
end