Class: Grpcx::Server::Interceptors::Rescue

Inherits:
GRPC::ServerInterceptor
  • Object
show all
Defined in:
lib/grpcx/server/interceptors/rescue.rb

Instance Method Summary collapse

Constructor Details

#initialize(rescuable, opts = {}) ⇒ Rescue

Returns a new instance of Rescue.



5
6
7
8
# File 'lib/grpcx/server/interceptors/rescue.rb', line 5

def initialize(rescuable, opts = {})
  @rescuable = rescuable
  super(opts)
end

Instance Method Details

#bidi_streamerObject



28
29
30
31
32
# File 'lib/grpcx/server/interceptors/rescue.rb', line 28

def bidi_streamer(*)
  yield
rescue StandardError => e
  @rescuable.rescue_with_handler(e) || raise
end

#client_streamerObject



16
17
18
19
20
# File 'lib/grpcx/server/interceptors/rescue.rb', line 16

def client_streamer(*)
  yield
rescue StandardError => e
  @rescuable.rescue_with_handler(e) || raise
end

#request_responseObject



10
11
12
13
14
# File 'lib/grpcx/server/interceptors/rescue.rb', line 10

def request_response(*)
  yield
rescue StandardError => e
  @rescuable.rescue_with_handler(e) || raise
end

#server_streamerObject



22
23
24
25
26
# File 'lib/grpcx/server/interceptors/rescue.rb', line 22

def server_streamer(*)
  yield
rescue StandardError => e
  @rescuable.rescue_with_handler(e) || raise
end