summaryrefslogtreecommitdiff
path: root/lib/chef/win32/error.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/win32/error.rb')
-rw-r--r--lib/chef/win32/error.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/chef/win32/error.rb b/lib/chef/win32/error.rb
index 1b3c104e85..8c3ff2f08f 100644
--- a/lib/chef/win32/error.rb
+++ b/lib/chef/win32/error.rb
@@ -59,13 +59,17 @@ class Chef
# Chef::Exceptions::Win32APIError:::
def self.raise!(message = nil, code = get_last_error)
msg = format_message(code).strip
- formatted_message = ""
- formatted_message << message if message
- formatted_message << "---- Begin Win32 API output ----\n"
- formatted_message << "System Error Code: #{code}\n"
- formatted_message << "System Error Message: #{msg}\n"
- formatted_message << "---- End Win32 API output ----\n"
- raise Chef::Exceptions::Win32APIError, msg + "\n" + formatted_message
+ if code == ERROR_USER_NOT_FOUND
+ raise Chef::Exceptions::UserIDNotFound, msg
+ else
+ formatted_message = ""
+ formatted_message << message if message
+ formatted_message << "---- Begin Win32 API output ----\n"
+ formatted_message << "System Error Code: #{code}\n"
+ formatted_message << "System Error Message: #{msg}\n"
+ formatted_message << "---- End Win32 API output ----\n"
+ raise Chef::Exceptions::Win32APIError, msg + "\n" + formatted_message
+ end
end
end
end