You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To summarize that discussion there, one option could be to throw a std::runtime_error exception when an invalid value is requested in a 'set' function, and making sure that functions like listSampleRates() are consistent with the values acceptable by the corresponding 'set' function (i.e. setSampleRate() in this example), so that the SoapySDR client application knows which values and settings are valid in advance.
In a similar fashion an exception could possibly also be thrown if say a call to the underlying 'sdrplay_api' methods were to fail (for instance if the call to 'sdrplay_api_Update()' returned an error status code for some reason), since currently those return codes are ignored by the SoapySDRPlay driver in many cases.
Franco
The text was updated successfully, but these errors were encountered:
recommendations or would be-specs by @guruofquality on which exceptions
Anything that inherits from std::exception. That way, we can reliably make exceptions and get their error messages. There are a lot of default exceptions to choose from: https://en.cppreference.com/w/cpp/error/exception But std::runtime_error is the most common
But honestly, there has never really been an attempt to differentiate between different errors thrown, ever. And the Soapy C API doesn't reflect this capability, and very very few writing exception handling code probably even want to do this.
So this code should catch all exceptions. I think anything not throwing exceptions that inherit from std::exception (inside of driver code) should probably just catch it and re-throw.
This purpose of this discussion is to come up with a good way of handling errors in the SoapySDRPlay driver.
Part of this discussion is here: #16 (see posts by @vsonnier and @jketterl; @SDRplay and @guruofquality are also mentioned there).
To summarize that discussion there, one option could be to throw a
std::runtime_error
exception when an invalid value is requested in a 'set' function, and making sure that functions like listSampleRates() are consistent with the values acceptable by the corresponding 'set' function (i.e. setSampleRate() in this example), so that the SoapySDR client application knows which values and settings are valid in advance.In a similar fashion an exception could possibly also be thrown if say a call to the underlying 'sdrplay_api' methods were to fail (for instance if the call to 'sdrplay_api_Update()' returned an error status code for some reason), since currently those return codes are ignored by the SoapySDRPlay driver in many cases.
Franco
The text was updated successfully, but these errors were encountered: