Skip to content

catch StandardError rather than the gratuitous Exception #586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/facter/facter_dot_d.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def txt_parser(file)
end
end
end
rescue Exception => e
rescue StandardError => e
Facter.warn("Failed to handle #{file} as text facts: #{e.class}: #{e}")
end

Expand All @@ -65,7 +65,7 @@ def json_parser(file)
setcode { v }
end
end
rescue Exception => e
rescue StandardError => e
Facter.warn("Failed to handle #{file} as json facts: #{e.class}: #{e}")
end

Expand All @@ -77,7 +77,7 @@ def yaml_parser(file)
setcode { v }
end
end
rescue Exception => e
rescue StandardError => e
Facter.warn("Failed to handle #{file} as yaml facts: #{e.class}: #{e}")
end

Expand Down Expand Up @@ -106,7 +106,7 @@ def script_parser(file)
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
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Puppet::Parser::Functions
# 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
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/parsejson.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Puppet::Parser::Functions

begin
PSON::load(arguments[0]) || arguments[1]
rescue Exception => e
rescue StandardError => e
if arguments[1]
arguments[1]
else
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/parseyaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Puppet::Parser::Functions

begin
YAML::load(arguments[0]) || arguments[1]
rescue Exception => e
rescue StandardError => e
if arguments[1]
arguments[1]
else
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/validate_cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down