The NoMethodError is raised when node['postgresql']['ruby']['packages'] is nil. The alternative would be to repeat the client_install+gem_install branch in an if/else block as well.

The Chef::Exceptions::Package error should be raised by the package provider when it fails. But in our case (zypper provider, potentially others?) a Chef::Exceptions::Execute error is raised instead.