Merge pull request #586 from ffrank/dont_catch_exception
catch StandardError rather than the gratuitous Exception
This commit is contained in:
commit
c5486aba62
5 changed files with 8 additions and 8 deletions
|
@ -48,7 +48,7 @@ class Facter::Util::DotD
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue StandardError => e
|
||||||
Facter.warn("Failed to handle #{file} as text facts: #{e.class}: #{e}")
|
Facter.warn("Failed to handle #{file} as text facts: #{e.class}: #{e}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class Facter::Util::DotD
|
||||||
setcode { v }
|
setcode { v }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue StandardError => e
|
||||||
Facter.warn("Failed to handle #{file} as json facts: #{e.class}: #{e}")
|
Facter.warn("Failed to handle #{file} as json facts: #{e.class}: #{e}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class Facter::Util::DotD
|
||||||
setcode { v }
|
setcode { v }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue StandardError => e
|
||||||
Facter.warn("Failed to handle #{file} as yaml facts: #{e.class}: #{e}")
|
Facter.warn("Failed to handle #{file} as yaml facts: #{e.class}: #{e}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ class Facter::Util::DotD
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue StandardError => e
|
||||||
Facter.warn("Failed to handle #{file} as script facts: #{e.class}: #{e}")
|
Facter.warn("Failed to handle #{file} as script facts: #{e.class}: #{e}")
|
||||||
Facter.debug(e.backtrace.join("\n\t"))
|
Facter.debug(e.backtrace.join("\n\t"))
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,7 +29,7 @@ Would return: {'a'=>1,'b'=>2,'c'=>3}
|
||||||
# This is to make it compatible with older version of Ruby ...
|
# This is to make it compatible with older version of Ruby ...
|
||||||
array = array.flatten
|
array = array.flatten
|
||||||
result = Hash[*array]
|
result = Hash[*array]
|
||||||
rescue Exception
|
rescue StandardError
|
||||||
raise(Puppet::ParseError, 'hash(): Unable to compute ' +
|
raise(Puppet::ParseError, 'hash(): Unable to compute ' +
|
||||||
'hash from array given')
|
'hash from array given')
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ be returned if the parsing of YAML string have failed.
|
||||||
|
|
||||||
begin
|
begin
|
||||||
PSON::load(arguments[0]) || arguments[1]
|
PSON::load(arguments[0]) || arguments[1]
|
||||||
rescue Exception => e
|
rescue StandardError => e
|
||||||
if arguments[1]
|
if arguments[1]
|
||||||
arguments[1]
|
arguments[1]
|
||||||
else
|
else
|
||||||
|
|
|
@ -16,7 +16,7 @@ be returned if the parsing of YAML string have failed.
|
||||||
|
|
||||||
begin
|
begin
|
||||||
YAML::load(arguments[0]) || arguments[1]
|
YAML::load(arguments[0]) || arguments[1]
|
||||||
rescue Exception => e
|
rescue StandardError => e
|
||||||
if arguments[1]
|
if arguments[1]
|
||||||
arguments[1]
|
arguments[1]
|
||||||
else
|
else
|
||||||
|
|
|
@ -53,7 +53,7 @@ module Puppet::Parser::Functions
|
||||||
rescue Puppet::ExecutionFailure => detail
|
rescue Puppet::ExecutionFailure => detail
|
||||||
msg += "\n#{detail}"
|
msg += "\n#{detail}"
|
||||||
raise Puppet::ParseError, msg
|
raise Puppet::ParseError, msg
|
||||||
rescue Exception => detail
|
rescue StandardError => detail
|
||||||
msg += "\n#{detail.class.name} #{detail}"
|
msg += "\n#{detail.class.name} #{detail}"
|
||||||
raise Puppet::ParseError, msg
|
raise Puppet::ParseError, msg
|
||||||
ensure
|
ensure
|
||||||
|
|
Loading…
Reference in a new issue