class Upfluence::Utils::Thrift::Middleware::ErrorCatcher

Public Class Methods

new(app, error_logger) click to toggle source
# File lib/upfluence/utils/thrift/middleware/error_catcher.rb, line 6
def initialize(app, error_logger)
  @app = app
  @error_logger = error_logger
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source
# File lib/upfluence/utils/thrift/middleware/error_catcher.rb, line 11
def method_missing(method, *args, &block)
  @app.send(method, *args, &block)
rescue ::Thrift::Exception => e
  raise e
rescue => e
  @error_logger.notify(e, method, *args)

  raise ::Thrift::ApplicationException.new(
    ::Thrift::ApplicationException::INTERNAL_ERROR,
    e.to_s
  )
end