Sha256: 341f7c639bb3a7d5e84672a37b4ce079227bce647bf1eeae7ce11736d3604f39
Contents?: true
Size: 1010 Bytes
Versions: 1
Compression:
Stored size: 1010 Bytes
Contents
# frozen_string_literal: true require_relative 'errors' module Evervault module Errors class ErrorMap 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 def self.raise_function_error_on_failure(body) error = body['error'] raise EvervaultError, 'An unexpected error occurred. Please contact Evervault support' unless error message = error['message'] stack = error['stack'] id = body['id'] raise FunctionRuntimeError.new(message, stack, id) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
evervault-3.0.1 | lib/evervault/errors/error_map.rb |