Class: Evervault::Errors::ErrorMap
- Inherits:
-
Object
- Object
- Evervault::Errors::ErrorMap
- Defined in:
- lib/evervault/errors/error_map.rb
Class Method Summary collapse
- .raise_errors_on_failure(_status_code, body, _headers) ⇒ Object
- .raise_function_error_on_failure(body) ⇒ Object
Class Method Details
.raise_errors_on_failure(_status_code, body, _headers) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/evervault/errors/error_map.rb', line 8 def self.raise_errors_on_failure(_status_code, body, _headers) parsed_body = JSON.parse(body) code = parsed_body['code'] detail = parsed_body['detail'] case code when 'functions/request-timeout' raise FunctionTimeoutError, detail when 'functions/function-not-ready' raise FunctionNotReadyError, detail when 'functions/forbidden-ip' raise ForbiddenIPError, detail else raise EvervaultError, detail end end |
.raise_function_error_on_failure(body) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/evervault/errors/error_map.rb', line 25 def self.raise_function_error_on_failure(body) error = body['error'] raise EvervaultError, 'An unexpected error occurred. Please contact Evervault support' unless error = error['message'] stack = error['stack'] id = body['id'] raise FunctionRuntimeError.new(, stack, id) end |