send_error_response

in lib/aws_lambda_ric/lambda_server.rb [59:73]


  def send_error_response(request_id:, error_object:, error:, xray_cause:)
    response_uri = URI(@server_address + "/runtime/invocation/#{request_id}/error")
    begin
      headers = { 'Lambda-Runtime-Function-Error-Type' => error.runtime_error_type, 'User-Agent' => @user_agent }
      headers['Lambda-Runtime-Function-XRay-Error-Cause'] = xray_cause if xray_cause.bytesize < MAX_HEADER_SIZE_BYTES
      Net::HTTP.post(
        response_uri,
        error_object.to_json,
        headers
      )
    rescue StandardError => e
      raise LambdaErrors::LambdaRuntimeError.new(e)
    end
  end