Exception: Optimizely::InvalidExperimentError
- Defined in:
- lib/optimizely/exceptions.rb
Instance Attribute Summary collapse
-
#experiment_id ⇒ Object
readonly
Raised when an invalid experiment key is provided.
-
#experiment_key ⇒ Object
readonly
Raised when an invalid experiment key is provided.
Instance Method Summary collapse
-
#initialize(experiment_id: nil, experiment_key: nil) ⇒ InvalidExperimentError
constructor
A new instance of InvalidExperimentError.
Constructor Details
#initialize(experiment_id: nil, experiment_key: nil) ⇒ InvalidExperimentError
Returns a new instance of InvalidExperimentError.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/optimizely/exceptions.rb', line 91 def initialize(experiment_id: nil, experiment_key: nil) raise ArgumentError, 'Either experiment_id or experiment_key must be provided.' if experiment_id.nil? && experiment_key.nil? raise ArgumentError, 'Cannot provide both experiment_id and experiment_key.' if !experiment_id.nil? && !experiment_key.nil? if experiment_id.nil? @experiment_key = experiment_key identifier = "key '#{@experiment_key}'" else @experiment_id = experiment_id identifier = "id '#{@experiment_id}'" end super("Experiment #{identifier} is not in datafile.") end |
Instance Attribute Details
#experiment_id ⇒ Object (readonly)
Raised when an invalid experiment key is provided
89 90 91 |
# File 'lib/optimizely/exceptions.rb', line 89 def experiment_id @experiment_id end |
#experiment_key ⇒ Object (readonly)
Raised when an invalid experiment key is provided
89 90 91 |
# File 'lib/optimizely/exceptions.rb', line 89 def experiment_key @experiment_key end |