Skip to content

Commit

Permalink
Ruby - ms_rest should throw validation error instead of NameError (Az…
Browse files Browse the repository at this point in the history
  • Loading branch information
vishrutshah committed Jul 13, 2016
1 parent c6106a3 commit 5d64b77
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/client/Ruby/ms-rest/lib/ms_rest/serialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,12 @@ def serialize_composite_type(mapper, object, object_name)

unless model_props.nil?
model_props.each do |key, value|
instance_variable = object.instance_variable_get("@#{key}")
begin
instance_variable = object.instance_variable_get("@#{key}")
rescue NameError
fail ValidationError, "instance variable '#{key}' is expected on '#{object.class}'."
end

if !instance_variable.nil? && instance_variable.respond_to?(:validate)
instance_variable.validate
end
Expand Down

0 comments on commit 5d64b77

Please sign in to comment.