Sha256: 03b5df41be5b07b442e1765e881bba4a2434b3e27750f6b02e49d0f4da192c49
Contents?: true
Size: 1.05 KB
Versions: 24
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true module Aws class ErrorHandler < Seahorse::Client::Handler private def error(context) body = context.http_response.body_contents if body.empty? code, message, data = http_status_error(context) else code, message, data = extract_error(body, context) end build_error(context, code, message, data) end def build_error(context, code, message, data) errors_module = context.client.class.errors_module errors_module.error_class(code).new(context, message, data) end def http_status_error(context) [http_status_error_code(context), '', EmptyStructure.new] end def http_status_error_code(context) status_code = context.http_response.status_code { 302 => 'MovedTemporarily', 304 => 'NotModified', 400 => 'BadRequest', 403 => 'Forbidden', 404 => 'NotFound', 412 => 'PreconditionFailed', 413 => 'RequestEntityTooLarge', }[status_code] || "Http#{status_code}Error" end end end
Version data entries
24 entries across 24 versions & 1 rubygems