Exception: Synthra::Errors::LatencyLimitError

Inherits:
ResourceLimitError show all
Defined in:
lib/synthra/errors.rb

Overview

Latency exceeds configured maximum

Raised when the @latency behavior specifies a delay that exceeds the configured max_latency_ms limit.

Examples:

# @latency 60000  <- 60 seconds exceeds default 10 second max
# LatencyLimitError: Latency 60000ms exceeds maximum allowed 10000ms

Constant Summary collapse

ERROR_CODE =
"LATENCY_LIMIT_ERROR"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(requested:, max_allowed:) ⇒ LatencyLimitError

Create a new LatencyLimitError

Parameters:

  • requested (Integer)

    the requested latency in milliseconds

  • max_allowed (Integer)

    the configured maximum latency



848
849
850
851
852
853
854
855
# File 'lib/synthra/errors.rb', line 848

def initialize(requested:, max_allowed:)
  @requested = requested
  @max_allowed = max_allowed
  super(
    "Latency #{requested}ms exceeds maximum allowed #{max_allowed}ms. " \
    "Configure via Synthra.configure { |c| c.limits.max_latency_ms = N }"
  )
end

Instance Attribute Details

#max_allowedInteger (readonly)

Returns the maximum allowed latency in milliseconds.

Returns:

  • (Integer)

    the maximum allowed latency in milliseconds



837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
# File 'lib/synthra/errors.rb', line 837

class LatencyLimitError < ResourceLimitError
  ERROR_CODE = "LATENCY_LIMIT_ERROR"
  attr_reader :requested, :max_allowed


  # Create a new LatencyLimitError
  #
  # @param requested [Integer] the requested latency in milliseconds
  # @param max_allowed [Integer] the configured maximum latency
  #

  def initialize(requested:, max_allowed:)
    @requested = requested
    @max_allowed = max_allowed
    super(
      "Latency #{requested}ms exceeds maximum allowed #{max_allowed}ms. " \
      "Configure via Synthra.configure { |c| c.limits.max_latency_ms = N }"
    )
  end
end

#requestedInteger (readonly)

Returns the requested latency in milliseconds.

Returns:

  • (Integer)

    the requested latency in milliseconds



837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
# File 'lib/synthra/errors.rb', line 837

class LatencyLimitError < ResourceLimitError
  ERROR_CODE = "LATENCY_LIMIT_ERROR"
  attr_reader :requested, :max_allowed


  # Create a new LatencyLimitError
  #
  # @param requested [Integer] the requested latency in milliseconds
  # @param max_allowed [Integer] the configured maximum latency
  #

  def initialize(requested:, max_allowed:)
    @requested = requested
    @max_allowed = max_allowed
    super(
      "Latency #{requested}ms exceeds maximum allowed #{max_allowed}ms. " \
      "Configure via Synthra.configure { |c| c.limits.max_latency_ms = N }"
    )
  end
end