Commit 26e6cfd3 authored by Kenton Varda's avatar Kenton Varda

Don't spew errors to the console whenever RPC gets disconnected. Fixes #163.

parent 48a5daaa
...@@ -359,8 +359,17 @@ public: ...@@ -359,8 +359,17 @@ public:
}); });
// Indicate disconnect. // Indicate disconnect.
disconnectFulfiller->fulfill(DisconnectInfo { auto shutdownPromise = connection.get<Connected>()->shutdown()
connection.get<Connected>()->shutdown().attach(kj::mv(connection.get<Connected>())) }); .attach(kj::mv(connection.get<Connected>()))
.then([]() -> kj::Promise<void> { return kj::READY_NOW; },
[](kj::Exception&& e) -> kj::Promise<void> {
// Don't report disconnects as an error.
if (e.getType() != kj::Exception::Type::DISCONNECTED) {
return kj::mv(e);
}
return kj::READY_NOW;
});
disconnectFulfiller->fulfill(DisconnectInfo { kj::mv(shutdownPromise) });
connection.init<Disconnected>(kj::mv(networkException)); connection.init<Disconnected>(kj::mv(networkException));
} }
......
...@@ -80,6 +80,9 @@ Exception::Type typeOfErrno(int error) { ...@@ -80,6 +80,9 @@ Exception::Type typeOfErrno(int error) {
#endif #endif
return Exception::Type::OVERLOADED; return Exception::Type::OVERLOADED;
#ifdef ENOTCONN:
case ENOTCONN:
#endif
#ifdef ECONNABORTED #ifdef ECONNABORTED
case ECONNABORTED: case ECONNABORTED:
#endif #endif
...@@ -120,6 +123,13 @@ Exception::Type typeOfErrno(int error) { ...@@ -120,6 +123,13 @@ Exception::Type typeOfErrno(int error) {
#endif #endif
#if defined(EOPNOTSUPP) && EOPNOTSUPP != ENOTSUP #if defined(EOPNOTSUPP) && EOPNOTSUPP != ENOTSUP
case EOPNOTSUPP: case EOPNOTSUPP:
#endif
#ifdef ENOPROTOOPT
case ENOPROTOOPT:
#endif
#ifdef ENOTSOCK
// This is really saying "syscall not implemented for non-sockets".
case ENOTSOCK:
#endif #endif
return Exception::Type::UNIMPLEMENTED; return Exception::Type::UNIMPLEMENTED;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment