Skip to content

Commit 920eb97

Browse files
committed
Raise a ValidationError for invalid XML
Invalid XML seems to be more of a ValidationError, not a StandardError. Raise accordingly. Signed-off-by: David Celis <[email protected]>
1 parent 05376ed commit 920eb97

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/onelogin/ruby-saml/logoutresponse.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def valid_saml?(soft = true)
105105
if soft
106106
@schema.validate(@xml).map{ return false }
107107
else
108-
@schema.validate(@xml).map{ |error| raise(StandardError.new("#{error.message}\n\n#{@xml.to_s}")) }
108+
@schema.validate(@xml).map{ |error| validation_error("#{error.message}\n\n#{@xml.to_s}") }
109109
end
110110
end
111111

test/logoutresponse_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class RubySamlTest < Test::Unit::TestCase
102102
should "raise error for invalid xml" do
103103
logoutresponse = Onelogin::Saml::Logoutresponse.new(invalid_xml_response, settings)
104104

105-
assert_raises(StandardError) { logoutresponse.validate! }
105+
assert_raises(Onelogin::Saml::ValidationError) { logoutresponse.validate! }
106106
end
107107
end
108108

0 commit comments

Comments
 (0)