SoapySDRPlay3 icon indicating copy to clipboard operation
SoapySDRPlay3 copied to clipboard

Error handling in SoapySDRPlay driver

Open fventuri opened this issue 3 years ago • 1 comments

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: https://github.com/SDRplay/SoapySDRPlay/issues/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

fventuri avatar Nov 26 '20 01:11 fventuri