Skip to content

Commit 37547a8

Browse files
committed
Merge pull request #76 from newrelic/inherit-from-standard-error
Don't use Exception, use StandardError
2 parents c0f38a1 + 920eb97 commit 37547a8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/onelogin/ruby-saml/logoutresponse.rb

Lines changed: 2 additions & 2 deletions
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(Exception.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

@@ -151,4 +151,4 @@ def validation_error(message)
151151
end
152152
end
153153
end
154-
end
154+
end

lib/onelogin/ruby-saml/validation_error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Onelogin
22
module Saml
3-
class ValidationError < Exception
3+
class ValidationError < StandardError
44
end
55
end
66
end

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(Exception) { logoutresponse.validate! }
105+
assert_raises(Onelogin::Saml::ValidationError) { logoutresponse.validate! }
106106
end
107107
end
108108

0 commit comments

Comments
 (0)