JuliaTelecom / SoapySDR.jl

Julia Wrappers for SoapySDR
https://juliatelecom.github.io/SoapySDR.jl/dev/
Other
15 stars 3 forks source link

Add error checking to all `SoapySDRDevice_` calls #75

Closed staticfloat closed 2 years ago

staticfloat commented 2 years ago

SoapySDR, being written in C++, uses C++ exceptions for most of its error reporting. However, when using the C API, these exceptions are automatically caught, and recorded in a global errno-like system [0]. This means that without explicit error checking, we never notice that we, for instance, fail to set the samplerate due to clock mismanagement. This PR adds some error management helper functions, and litters our function wrapper code with @soapy_checked to automatically throw Julia exceptions when something goes awry.

[0] https://github.com/pothosware/SoapySDR/blob/4e71a35e5dec5b63fa95be572e3ad39adb260e15/lib/ErrorHelpers.hpp#L16-L19