Exception: Episodic::Platform::InvalidParameters

Inherits:
ResponseError show all
Defined in:
lib/episodic/platform/exceptions.rb

Overview

The value specified for a parameter is not valid.

Instance Attribute Summary

Attributes inherited from ResponseError

#response

Instance Method Summary collapse

Constructor Details

#initialize(message, response, invalid_parameters) ⇒ InvalidParameters

Constructor. Override to include inforation about the invalid parameter(s).

Parameters

message<String>

The message to include in the exception

response<Episodic::Platform::HTTPResponse>

The response object.

invalid_parameters<Object>

This is either a Hash or an Array of hashes if there is more than one invalid parameter.



90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/episodic/platform/exceptions.rb', line 90

def initialize(message, response, invalid_parameters)
  
  if (invalid_parameters)
    invalid_parameters["invalid_parameter"] = [invalid_parameters["invalid_parameter"]] if invalid_parameters["invalid_parameter"].is_a?(Hash)
    
    # Append to the message
    invalid_parameters["invalid_parameter"].each do |ip|
      message << "\n#{ip['name']}: #{ip['content']}"
    end
  end
  
  super(message, response)
end