Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception handling #77

Merged
merged 20 commits into from
Jan 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add version info, update to 0.7.1
jharmer95 committed Jan 19, 2022
commit 57dfa6c68123a204eeae981173b0d64bcbd20c64
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ cmake_minimum_required(VERSION 3.16)

project(
"rpc.hpp"
VERSION 0.6.2
VERSION 0.7.1
DESCRIPTION "Simple RPC Header-Only Library"
LANGUAGES CXX
)
5 changes: 4 additions & 1 deletion include/rpc.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
///@file rpc.hpp
///@author Jackson Harmer ([email protected])
///@brief Header-only library for serialized RPC usage
///@version 0.6.2
///@version 0.7.1
///
///@copyright
///BSD 3-Clause License
@@ -71,6 +71,9 @@
///@brief Top-level namespace for rpc.hpp classes and functions
namespace rpc
{
///@brief Array containing the version information for rpc.hpp
static constexpr unsigned version[]{ 0, 7, 1 };

namespace exceptions
{
enum class Type
8 changes: 4 additions & 4 deletions include/rpc_adapters/rpc_boost_json.hpp
Original file line number Diff line number Diff line change
@@ -264,7 +264,7 @@ template<typename R, typename... Args>
object_t obj{};
obj["func_name"] = pack.get_func_name();

auto& args = ret_j["args"].emplace_array();
auto& args = obj["args"].emplace_array();
args.reserve(sizeof...(Args));

const auto& argTup = pack.get_args();
@@ -286,7 +286,7 @@ template<typename R, typename... Args>
}
}

return ret_j;
return obj;
}

template<>
@@ -318,7 +318,7 @@ template<typename R, typename... Args>
}
else
{
if (obj.contains("result") && !obj["result"].is_null())
if (obj.contains("result") && !obj.at("result").is_null())
{
return ::rpc::details::packed_func<R, Args...>(obj.at("func_name").get_string().c_str(),
adapters::boost_json::details::parse_arg<R>(obj.at("result")),
@@ -331,7 +331,7 @@ template<typename R, typename... Args>

if (obj.contains("except_type"))
{
pack.set_exception(obj.at("err_mesg").get_string.c_str(),
pack.set_exception(obj.at("err_mesg").get_string().c_str(),
static_cast<exceptions::Type>(obj.at("except_type").get_int64()));
}