Exception: Synthra::Errors::InvalidProbabilityError
- Inherits:
-
ParseError
- Object
- StandardError
- Error
- ParseError
- Synthra::Errors::InvalidProbabilityError
- Defined in:
- lib/synthra/errors.rb
Overview
Invalid probability specification
Raised when enum probabilities exceed 100% total.
Constant Summary collapse
- ERROR_CODE =
"INVALID_PROBABILITY_ERROR"
Instance Attribute Summary collapse
-
#total ⇒ Numeric
readonly
The total probability that exceeded 100%.
Instance Method Summary collapse
-
#initialize(total, **kwargs) ⇒ InvalidProbabilityError
constructor
Create a new InvalidProbabilityError.
Constructor Details
#initialize(total, **kwargs) ⇒ InvalidProbabilityError
Create a new InvalidProbabilityError
413 414 415 416 |
# File 'lib/synthra/errors.rb', line 413 def initialize(total, **kwargs) @total = total super("Probability total #{total}% exceeds 100%", **kwargs) end |
Instance Attribute Details
#total ⇒ Numeric (readonly)
Returns the total probability that exceeded 100%.
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/synthra/errors.rb', line 402 class InvalidProbabilityError < ParseError ERROR_CODE = "INVALID_PROBABILITY_ERROR" attr_reader :total # Create a new InvalidProbabilityError # # @param total [Numeric] the total probability percentage # @param kwargs [Hash] location information (line, column, source_line) # def initialize(total, **kwargs) @total = total super("Probability total #{total}% exceeds 100%", **kwargs) end end |