Exception: Synthra::Errors::TextLengthLimitError
- Inherits:
-
ResourceLimitError
- Object
- StandardError
- Error
- ResourceLimitError
- Synthra::Errors::TextLengthLimitError
- Defined in:
- lib/synthra/errors.rb
Overview
Text length exceeds configured maximum
Raised when generating text with more characters than the configured max_text_length limit.
Constant Summary collapse
- ERROR_CODE =
"TEXT_LENGTH_LIMIT_ERROR"
Instance Attribute Summary collapse
-
#length ⇒ Integer
readonly
The requested text length.
-
#max_allowed ⇒ Integer
readonly
The maximum allowed text length.
Instance Method Summary collapse
-
#initialize(length:, max_allowed:) ⇒ TextLengthLimitError
constructor
Create a new TextLengthLimitError.
Constructor Details
#initialize(length:, max_allowed:) ⇒ TextLengthLimitError
Create a new TextLengthLimitError
962 963 964 965 966 967 968 969 |
# File 'lib/synthra/errors.rb', line 962 def initialize(length:, max_allowed:) @length = length @max_allowed = max_allowed super( "Text length #{length} exceeds maximum allowed #{max_allowed}. " \ "Configure via Synthra.configure { |c| c.limits.max_text_length = N }" ) end |
Instance Attribute Details
#length ⇒ Integer (readonly)
Returns the requested text length.
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 |
# File 'lib/synthra/errors.rb', line 951 class TextLengthLimitError < ResourceLimitError ERROR_CODE = "TEXT_LENGTH_LIMIT_ERROR" attr_reader :length, :max_allowed # Create a new TextLengthLimitError # # @param length [Integer] the requested text length # @param max_allowed [Integer] the maximum allowed text length # def initialize(length:, max_allowed:) @length = length @max_allowed = max_allowed super( "Text length #{length} exceeds maximum allowed #{max_allowed}. " \ "Configure via Synthra.configure { |c| c.limits.max_text_length = N }" ) end end |
#max_allowed ⇒ Integer (readonly)
Returns the maximum allowed text length.
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 |
# File 'lib/synthra/errors.rb', line 951 class TextLengthLimitError < ResourceLimitError ERROR_CODE = "TEXT_LENGTH_LIMIT_ERROR" attr_reader :length, :max_allowed # Create a new TextLengthLimitError # # @param length [Integer] the requested text length # @param max_allowed [Integer] the maximum allowed text length # def initialize(length:, max_allowed:) @length = length @max_allowed = max_allowed super( "Text length #{length} exceeds maximum allowed #{max_allowed}. " \ "Configure via Synthra.configure { |c| c.limits.max_text_length = N }" ) end end |