Skip to content

Commit

Permalink
Raise a ValidationError for invalid XML
Browse files Browse the repository at this point in the history
Invalid XML seems to be more of a ValidationError, not a StandardError.
Raise accordingly.

Signed-off-by: David Celis <[email protected]>
  • Loading branch information
davidcelis committed Mar 27, 2013
1 parent 05376ed commit 920eb97
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/onelogin/ruby-saml/logoutresponse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def valid_saml?(soft = true)
if soft
@schema.validate(@xml).map{ return false }
else
@schema.validate(@xml).map{ |error| raise(StandardError.new("#{error.message}\n\n#{@xml.to_s}")) }
@schema.validate(@xml).map{ |error| validation_error("#{error.message}\n\n#{@xml.to_s}") }
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/logoutresponse_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class RubySamlTest < Test::Unit::TestCase
should "raise error for invalid xml" do
logoutresponse = Onelogin::Saml::Logoutresponse.new(invalid_xml_response, settings)

assert_raises(StandardError) { logoutresponse.validate! }
assert_raises(Onelogin::Saml::ValidationError) { logoutresponse.validate! }
end
end

Expand Down

0 comments on commit 920eb97

Please sign in to comment.