aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/deps/rpclib/include/rpc/rpc_error.h
diff options
context:
space:
mode:
authorAndrej Rode <andrej.rode@ettus.com>2017-04-03 18:49:58 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:45 -0800
commit53795c74aead4e6021bc788b788f8ed5b4a0166d (patch)
tree45e4075f3d8ffdee7dff7c72dd665f5c5b0c746c /host/lib/deps/rpclib/include/rpc/rpc_error.h
parent6a12add1560545438e1bebc05efbafd05aace4f9 (diff)
downloaduhd-53795c74aead4e6021bc788b788f8ed5b4a0166d.tar.gz
uhd-53795c74aead4e6021bc788b788f8ed5b4a0166d.tar.bz2
uhd-53795c74aead4e6021bc788b788f8ed5b4a0166d.zip
uhd: add cut-down rpclib source tree and import tool
Diffstat (limited to 'host/lib/deps/rpclib/include/rpc/rpc_error.h')
-rw-r--r--host/lib/deps/rpclib/include/rpc/rpc_error.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/host/lib/deps/rpclib/include/rpc/rpc_error.h b/host/lib/deps/rpclib/include/rpc/rpc_error.h
new file mode 100644
index 000000000..81a5b2c9d
--- /dev/null
+++ b/host/lib/deps/rpclib/include/rpc/rpc_error.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#ifndef RPC_ERROR_H_NEOOSTKY
+#define RPC_ERROR_H_NEOOSTKY
+
+#include <exception>
+
+#include "rpc/msgpack.hpp"
+#include "rpc/config.h"
+
+namespace rpc {
+
+//! \brief This exception is thrown by the client when the server signals an
+//! error during a call.
+//!
+//! This type allows clients to handle arbitrary error objects as the
+//! msgpack-rpc specification allows. In client code you probably don't want to
+//! throw it, hence its constructor is private.
+class rpc_error : public std::runtime_error {
+public:
+ //! \brief Returns the name of the function that was
+ //! called on the server while the error occurred.
+ std::string get_function_name() const;
+
+ //! \brief Returns the error object that the server
+ //! provided.
+ virtual RPCLIB_MSGPACK::object_handle& get_error();
+
+private:
+ friend class client;
+ rpc_error(std::string const &what_arg, std::string const &function_name,
+ RPCLIB_MSGPACK::object_handle o);
+
+private:
+ std::string func_name_;
+ RPCLIB_MSGPACK::object_handle ob_h_;
+};
+
+class timeout : public std::runtime_error {
+public:
+ const char *what() const noexcept override;
+
+private:
+ friend class client;
+ explicit timeout(std::string const &what_arg);
+ std::string formatted;
+};
+
+} /* rpc */
+
+
+#endif /* end of include guard: RPC_ERROR_H_NEOOSTKY */