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:
});
// Indicate disconnect.
disconnectFulfiller->fulfill(DisconnectInfo {
connection.get<Connected>()->shutdown().attach(kj::mv(connection.get<Connected>())) });
auto shutdownPromise = connection.get<Connected>()->shutdown()
.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));
}
......
......@@ -80,6 +80,9 @@ Exception::Type typeOfErrno(int error) {
#endif
return Exception::Type::OVERLOADED;
#ifdef ENOTCONN:
case ENOTCONN:
#endif
#ifdef ECONNABORTED
case ECONNABORTED:
#endif
......@@ -120,6 +123,13 @@ Exception::Type typeOfErrno(int error) {
#endif
#if defined(EOPNOTSUPP) && EOPNOTSUPP != ENOTSUP
case EOPNOTSUPP:
#endif
#ifdef ENOPROTOOPT
case ENOPROTOOPT:
#endif
#ifdef ENOTSOCK
// This is really saying "syscall not implemented for non-sockets".
case ENOTSOCK:
#endif
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