# File lib/aws/core/client.rb, line 406
      def populate_error response

        status = response.http_response.status

        error_code, error_message = extract_error_details(response)

        error_args = [
          response.http_request,
          response.http_response,
          error_code,
          error_message
        ]

        response.error =
          case
          when response.network_error? then response.http_response.network_error
          when error_code then error_class(error_code).new(*error_args)
          when status >= 500 then Errors::ServerError.new(*error_args)
          when status >= 300 then Errors::ClientError.new(*error_args)
          else nil # no error
          end

      end