Skip to content

Commit

Permalink
print GetLastError() result instead of errno (wjwwood#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmoyer authored and wjwwood committed Jan 13, 2018
1 parent 534141a commit 235a5f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/impl/win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ Serial::SerialImpl::open ()
0);

if (fd_ == INVALID_HANDLE_VALUE) {
DWORD errno_ = GetLastError();
DWORD create_file_err = GetLastError();
stringstream ss;
switch (errno_) {
switch (create_file_err) {
case ERROR_FILE_NOT_FOUND:
// Use this->getPort to convert to a std::string
ss << "Specified port, " << this->getPort() << ", does not exist.";
THROW (IOException, ss.str().c_str());
default:
ss << "Unknown error opening the serial port: " << errno;
ss << "Unknown error opening the serial port: " << create_file_err;
THROW (IOException, ss.str().c_str());
}
}
Expand Down

0 comments on commit 235a5f7

Please sign in to comment.