diff options
author | Bryan McLellan <btm@loftninjas.org> | 2014-08-22 15:31:03 -0400 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2014-08-22 19:07:23 -0400 |
commit | ec0ff9515757443b07a50a412a0a9b70a68de689 (patch) | |
tree | 3deb50d7dc540ac16a2465b6a96eb964b6585a89 /lib/chef/util | |
parent | b82a5272ec6798cf26bcf9feaf39faae451b574d (diff) | |
download | chef-ec0ff9515757443b07a50a412a0a9b70a68de689.tar.gz |
Make exception for a user not existing more explicit
Diffstat (limited to 'lib/chef/util')
-rw-r--r-- | lib/chef/util/windows/net_user.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb index 5cca348c8e..808352292e 100644 --- a/lib/chef/util/windows/net_user.rb +++ b/lib/chef/util/windows/net_user.rb @@ -17,6 +17,7 @@ # require 'chef/util/windows' +require 'chef/exceptions' #wrapper around a subset of the NetUser* APIs. #nothing Chef specific, but not complete enough to be its own gem, so util for now. @@ -137,9 +138,8 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows ptr = 0.chr * PTR_SIZE rc = NetUserGetInfo.call(nil, @name, 3, ptr) - if rc != NERR_Success - raise ArgumentError, get_last_error(rc) - end + raise Chef::Exceptions::UserIDNotFound, get_last_error(rc) if rc == NERR_UserNotFound + raise ArgumentError, get_last_error(rc) if rc != NERR_Success ptr = ptr.unpack('L')[0] buffer = 0.chr * SIZEOF_USER_INFO_3 |