diff options
Diffstat (limited to 'mpm/lib/rfdc/rfdc_throw.cpp')
-rw-r--r-- | mpm/lib/rfdc/rfdc_throw.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mpm/lib/rfdc/rfdc_throw.cpp b/mpm/lib/rfdc/rfdc_throw.cpp new file mode 100644 index 000000000..a50fe7c96 --- /dev/null +++ b/mpm/lib/rfdc/rfdc_throw.cpp @@ -0,0 +1,24 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +extern "C" { +#include "mpm/rfdc/rfdc_throw.h" +} +#include <mpm/exception.hpp> +#include <string> + +/** + * A function to throw MPM exceptions from within the Xilinx RFdc API + */ +void rfdc_throw(const char* msg) +{ + if (msg) { + std::string error_msg(msg); + throw mpm::assertion_error("Error in RFDC code: " + error_msg); + } else { + throw mpm::assertion_error("Error in RFDC code."); + } +} |