Module: Gruf::Errors::Helpers

Included in:
Controllers::Base, Interceptors::ServerInterceptor
Defined in:
lib/gruf/errors/helpers.rb

Overview

Helper module for standardizing error interaction

Instance Method Summary collapse

Instance Method Details

#fail!(error_code, app_code = nil, message = '', metadata = {}) ⇒ Object

Will issue a GRPC BadStatus exception, with a code based on the code passed.



34
35
36
37
38
39
40
41
# File 'lib/gruf/errors/helpers.rb', line 34

def fail!(error_code, app_code = nil, message = '',  = {})
  e = error
  e.code = error_code.to_sym
  e.app_code = app_code ? app_code.to_sym : e.code
  e.message = message.to_s
  e. = 
  e.fail!(request.active_call)
end