File: rpc_error.h

package info (click to toggle)
uhd 3.13.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 207,120 kB
  • sloc: cpp: 167,245; ansic: 86,841; vhdl: 53,420; python: 40,839; xml: 13,167; tcl: 5,688; makefile: 2,167; sh: 1,719; pascal: 230; csh: 94; asm: 20; perl: 11
file content (52 lines) | stat: -rw-r--r-- 1,338 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 */