From 1ffcb82048cb42edefcb27f8a9cdedd31d65c454 Mon Sep 17 00:00:00 2001 From: Stephan Linz Date: Wed, 29 Jun 2016 11:54:05 +0200 Subject: [PATCH] wrong usage of std::exception 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: #2 Related-to-issue: #4 Signed-off-by: Stephan Linz --- src/DeviceImpl.cpp | 4 ++-- src/LibusbImpl.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DeviceImpl.cpp b/src/DeviceImpl.cpp index f434edc..d6b6e1f 100644 --- a/src/DeviceImpl.cpp +++ b/src/DeviceImpl.cpp @@ -65,7 +65,7 @@ std::shared_ptr LibUSB::DeviceImpl::getDeviceDescripto if (Result != LIBUSB_SUCCESS) { - throw std::exception("libusb_get_device_descriptor() failed."); + throw std::runtime_error("libusb_get_device_descriptor() failed."); } } @@ -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) diff --git a/src/LibusbImpl.cpp b/src/LibusbImpl.cpp index c7d90a0..84d5cd3 100644 --- a/src/LibusbImpl.cpp +++ b/src/LibusbImpl.cpp @@ -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