diff options
author | varac <varacanero@zeromail.org> | 2012-10-31 13:34:29 +0100 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2012-10-31 13:34:29 +0100 |
commit | 95beaab25a31a6b295d9c8ce809cc254a109e484 (patch) | |
tree | 5c2238ed499299b317b6d164713889df49d49ff6 /lib | |
parent | b4020afadc24aa6c1da3a1b8b0b2aa7936353d1d (diff) | |
parent | 8e8d084b8eb8d74a47d2a29eaf15f6c5ac2aa0ed (diff) |
Merge branch 'master' of git://github.com/camptocamp/puppet-couchdb
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/functions/couchdblookup.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/puppet/parser/functions/couchdblookup.rb b/lib/puppet/parser/functions/couchdblookup.rb index 132c488..b9067d2 100644 --- a/lib/puppet/parser/functions/couchdblookup.rb +++ b/lib/puppet/parser/functions/couchdblookup.rb @@ -16,8 +16,16 @@ module Puppet::Parser::Functions begin json = JSON.parse(open(URI.parse(url)).read) - rescue OpenURI::HTTPError, JSON::ParserError => error - raise Puppet::ParseError, "couchdblookup(): fetching URL #{url} failed with status #{error.message}" + rescue OpenURI::HTTPError => error + raise Puppet::ParseError, "couchdblookup(): fetching URL #{url} failed with status '#{error.message}'" + rescue Timeout::Error => error + raise Puppet::ParseError, "couchdblookup(): connection to couchdb server timed out: '#{error.message}'" + rescue Errno::ECONNREFUSED => error + raise Puppet::ParseError, "couchdblookup(): connection to couchdb server failed: '#{error.message}'" + rescue JSON::ParserError => error + raise Puppet::ParseError, "couchdblookup(): failed to parse JSON received from couchdb: '#{error.message}'" + rescue StandardError => error + raise Puppet::ParseError, "couchdblookup(): something unexpected happened: '#{error.inspect}'" end result = nil |