summaryrefslogtreecommitdiff
path: root/lib/chef/util
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2014-08-22 15:31:03 -0400
committerBryan McLellan <btm@loftninjas.org>2014-08-22 19:07:23 -0400
commitec0ff9515757443b07a50a412a0a9b70a68de689 (patch)
tree3deb50d7dc540ac16a2465b6a96eb964b6585a89 /lib/chef/util
parentb82a5272ec6798cf26bcf9feaf39faae451b574d (diff)
downloadchef-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.rb6
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