summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2011-01-10 14:17:14 -0800
committerPaul Berry <paul@puppetlabs.com>2011-01-12 16:28:43 -0800
commit2b9b7a5f7fe4b673f0d1fba9fb523cc0e2e34fa5 (patch)
treebc245cc31d1dc1a3d1a831f6df5c31993a633321
parent08561b22920aa5eaa76addd8b0da8feb189e0d18 (diff)
downloadpuppet-2b9b7a5f7fe4b673f0d1fba9fb523cc0e2e34fa5.tar.gz
puppet-2b9b7a5f7fe4b673f0d1fba9fb523cc0e2e34fa5.tar.xz
puppet-2b9b7a5f7fe4b673f0d1fba9fb523cc0e2e34fa5.zip
(#5838) Refactored error handling logic into find_in_cache.
Moved the error handling logic surrounding the call to Puppet::Indirector::Indirection#find_in_cache() into the find_in_cache() method itself, so that won't need to be duplicated when find_in_cache() is called from elsewhere. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
-rw-r--r--lib/puppet/indirector/indirection.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb
index a010c4e40..4341f7cb2 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -180,13 +180,8 @@ class Puppet::Indirector::Indirection
request = request(:find, key, *args)
terminus = prepare(request)
- begin
- if result = find_in_cache(request)
- return result
- end
- rescue => detail
- puts detail.backtrace if Puppet[:trace]
- Puppet.err "Cached #{self.name} for #{request.key} failed: #{detail}"
+ if result = find_in_cache(request)
+ return result
end
# Otherwise, return the result from the terminus, caching if appropriate.
@@ -213,6 +208,10 @@ class Puppet::Indirector::Indirection
Puppet.debug "Using cached #{self.name} for #{request.key}"
cached
+ rescue => detail
+ puts detail.backtrace if Puppet[:trace]
+ Puppet.err "Cached #{self.name} for #{request.key} failed: #{detail}"
+ nil
end
# Remove something via the terminus.