Sha256: f346233088d06953cd610ba79c5c6f1a5d1a39861723dbd62ac5019fe18d918c

Contents?: true

Size: 1.49 KB

Versions: 18

Compression:

Stored size: 1.49 KB

Contents

# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require_relative 'base'
require_relative 'message'

module Contrast
  module Agent
    module Telemetry
      module Exception
        # This class will hold the basic information for a Parent Telemetry Exception Event
        class Event < Contrast::Agent::Telemetry::Exception::Base
          # Array of Telemetry Exceptions
          # @return [Array<Contrast::Agent::Telemetry::Exception::Message>]
          attr_reader :exceptions

          # Initialization of the Parent Event requires us to require the exception
          # to be created
          #
          # @param message [Contrast::Agent::Telemetry::Exception::Message]
          # @raise[ArgumentError]
          def initialize message
            super()
            validate_class(message, Contrast::Agent::Telemetry::Exception::Message, 'exception_message')
            @exceptions = Array.new(1, message)
          end

          # @param message [Contrast::Agent::Telemetry::Exception::Message]
          # @raise[ArgumentError]
          def push message
            validate_class(message, Contrast::Agent::Telemetry::Exception::Message, 'exception_message')
            @exceptions << message
          end

          def self.path
            '/error'
          end

          def to_controlled_hash
            exceptions.map(&:to_controlled_hash)
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
contrast-agent-7.6.1 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-7.6.0 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-7.5.0 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-7.4.1 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-7.4.0 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-7.3.2 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-7.3.1 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-7.3.0 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-7.2.0 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-7.1.0 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-7.0.0 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-6.15.3 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-6.15.2 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-6.15.1 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-6.15.0 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-6.14.0 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-6.13.0 lib/contrast/agent/telemetry/exception/event.rb
contrast-agent-6.12.0 lib/contrast/agent/telemetry/exception/event.rb