Merge pull request #586 from ffrank/dont_catch_exception

catch StandardError rather than the gratuitous Exception
This commit is contained in:
Bryan Jen 2016-03-29 09:13:46 -07:00
commit c5486aba62
5 changed files with 8 additions and 8 deletions

View file

@ -48,7 +48,7 @@ class Facter::Util::DotD
end
end
end
rescue Exception => e
rescue StandardError => e
Facter.warn("Failed to handle #{file} as text facts: #{e.class}: #{e}")
end
@ -65,7 +65,7 @@ class Facter::Util::DotD
setcode { v }
end
end
rescue Exception => e
rescue StandardError => e
Facter.warn("Failed to handle #{file} as json facts: #{e.class}: #{e}")
end
@ -77,7 +77,7 @@ class Facter::Util::DotD
setcode { v }
end
end
rescue Exception => e
rescue StandardError => e
Facter.warn("Failed to handle #{file} as yaml facts: #{e.class}: #{e}")
end
@ -106,7 +106,7 @@ class Facter::Util::DotD
end
end
end
rescue Exception => e
rescue StandardError => e
Facter.warn("Failed to handle #{file} as script facts: #{e.class}: #{e}")
Facter.debug(e.backtrace.join("\n\t"))
end

View file

@ -29,7 +29,7 @@ Would return: {'a'=>1,'b'=>2,'c'=>3}
# This is to make it compatible with older version of Ruby ...
array = array.flatten
result = Hash[*array]
rescue Exception
rescue StandardError
raise(Puppet::ParseError, 'hash(): Unable to compute ' +
'hash from array given')
end

View file

@ -15,7 +15,7 @@ be returned if the parsing of YAML string have failed.
begin
PSON::load(arguments[0]) || arguments[1]
rescue Exception => e
rescue StandardError => e
if arguments[1]
arguments[1]
else

View file

@ -16,7 +16,7 @@ be returned if the parsing of YAML string have failed.
begin
YAML::load(arguments[0]) || arguments[1]
rescue Exception => e
rescue StandardError => e
if arguments[1]
arguments[1]
else

View file

@ -53,7 +53,7 @@ module Puppet::Parser::Functions
rescue Puppet::ExecutionFailure => detail
msg += "\n#{detail}"
raise Puppet::ParseError, msg
rescue Exception => detail
rescue StandardError => detail
msg += "\n#{detail.class.name} #{detail}"
raise Puppet::ParseError, msg
ensure