Skip to content
Snippets Groups Projects
Commit b507a3f1 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Remove int exceptions

parent 05ffd8a5
No related branches found
No related tags found
No related merge requests found
Pipeline #13865 passed
......@@ -6,6 +6,7 @@
#endif
#include <ftl/net/common.hpp>
#include <ftl/exception.hpp>
//#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <loguru.hpp>
......@@ -343,7 +344,8 @@ R Peer::call(const std::string &name, ARGS... args) {
if (!hasreturned) {
cancelCall(id);
throw 1;
LOG(ERROR) << "RPC Timeout: " << name;
throw ftl::exception("RPC failed with timeout");
}
return result;
......
......@@ -378,7 +378,7 @@ R Universe::call(const ftl::UUID &pid, const std::string &name, ARGS... args) {
if (p == nullptr || !p->isConnected()) {
if (p == nullptr) DLOG(WARNING) << "Attempting to call an unknown peer : " << pid.to_string();
else DLOG(WARNING) << "Attempting to call an disconnected peer : " << pid.to_string();
throw -1;
throw ftl::exception("Calling disconnected peer");
}
return p->call<R>(name, args...);
}
......
......@@ -2,6 +2,7 @@
#include <loguru.hpp>
#include <ftl/net/dispatcher.hpp>
#include <ftl/net/peer.hpp>
#include <ftl/exception.hpp>
#include <iostream>
using ftl::net::Peer;
......@@ -88,13 +89,6 @@ void ftl::net::Dispatcher::dispatch_call(Peer &s, const msgpack::object &msg) {
std::stringstream buf;
msgpack::pack(buf, res_obj);
s.send("__return__", buf.str());*/
} catch (int e) {
//throw;
LOG(ERROR) << "Exception when attempting to call RPC (" << e << ")";
/*response_t res_obj = std::make_tuple(1,id,msgpack::object(e),msgpack::object());
std::stringstream buf;
msgpack::pack(buf, res_obj);
s.send("__return__", buf.str());*/
}
} else {
LOG(WARNING) << "No binding found for " << name;
......@@ -150,7 +144,7 @@ void ftl::net::Dispatcher::enforce_arg_count(std::string const &func, std::size_
std::size_t expected) {
if (found != expected) {
LOG(FATAL) << "RPC argument missmatch for '" << func << "' - " << found << " != " << expected;
throw -1;
throw ftl::exception("RPC argument missmatch");
}
}
......@@ -158,7 +152,7 @@ void ftl::net::Dispatcher::enforce_unique_name(std::string const &func) {
auto pos = funcs_.find(func);
if (pos != end(funcs_)) {
LOG(FATAL) << "RPC non unique binding for '" << func << "'";
throw -1;
throw ftl::exception("RPC binding not unique");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment