Exception: Synthra::Errors::RecursionLimitError

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

Overview

Recursion depth exceeds configured maximum

Raised when nested schema generation exceeds the maximum recursion depth, which could indicate a circular reference or overly deep nesting.

Examples:

# Deeply nested: User -> Profile -> Settings -> Preferences -> ...
# RecursionLimitError: Recursion depth 11 exceeds maximum allowed 10

Constant Summary collapse

ERROR_CODE =
"RECURSION_LIMIT_ERROR"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(depth:, max_allowed:) ⇒ RecursionLimitError

Create a new RecursionLimitError

Parameters:

  • depth (Integer)

    the current recursion depth

  • max_allowed (Integer)

    the configured maximum depth



886
887
888
889
890
891
892
893
# File 'lib/synthra/errors.rb', line 886

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

Instance Attribute Details

#depthInteger (readonly)

Returns the current recursion depth.

Returns:

  • (Integer)

    the current recursion depth



875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
# File 'lib/synthra/errors.rb', line 875

class RecursionLimitError < ResourceLimitError
  ERROR_CODE = "RECURSION_LIMIT_ERROR"
  attr_reader :depth, :max_allowed


  # Create a new RecursionLimitError
  #
  # @param depth [Integer] the current recursion depth
  # @param max_allowed [Integer] the configured maximum depth
  #

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

#max_allowedInteger (readonly)

Returns the maximum allowed recursion depth.

Returns:

  • (Integer)

    the maximum allowed recursion depth



875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
# File 'lib/synthra/errors.rb', line 875

class RecursionLimitError < ResourceLimitError
  ERROR_CODE = "RECURSION_LIMIT_ERROR"
  attr_reader :depth, :max_allowed


  # Create a new RecursionLimitError
  #
  # @param depth [Integer] the current recursion depth
  # @param max_allowed [Integer] the configured maximum depth
  #

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