Skip to content

Commit

Permalink
wrong usage of std::exception
Browse files Browse the repository at this point in the history
std::exception has no constructor which takes a c-string as argument,
this seems to be Microsoft specific.

See: http://stackoverflow.com/a/1570192

Error was:

error: no matching function for call to
       'std::exception::exception(const char [X])'

Related-to-issue: zarthcode#2
Related-to-issue: zarthcode#4
Signed-off-by: Stephan Linz <[email protected]>
  • Loading branch information
rexut committed Nov 28, 2016
1 parent 84387ab commit 1ffcb82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/DeviceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ std::shared_ptr<libusb_device_descriptor> LibUSB::DeviceImpl::getDeviceDescripto

if (Result != LIBUSB_SUCCESS)
{
throw std::exception("libusb_get_device_descriptor() failed.");
throw std::runtime_error("libusb_get_device_descriptor() failed.");
}

}
Expand All @@ -87,7 +87,7 @@ void LibUSB::DeviceImpl::Open()

if (m_pDevice.get() == nullptr)
{
throw std::exception("Open() failed - (There is no device!)");
throw std::runtime_error("Open() failed - (There is no device!)");
}

if (m_pHandle.get() == nullptr)
Expand Down
2 changes: 1 addition & 1 deletion src/LibusbImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ LibUSB::LibUSBImpl::LibUSBImpl()
int Result = libusb_init(&pContext);
if (Result != LIBUSB_SUCCESS)
{
throw std::exception("libusb_init() failed.");
throw std::runtime_error("libusb_init() failed.");
}

// Store in a shared_ptr
Expand Down

0 comments on commit 1ffcb82

Please sign in to comment.