Commit 2906dd94 authored by Darrin D'Mello's avatar Darrin D'Mello Committed by Facebook Github Bot

Clean up AsyncSocketException interface to hide members that should be private

Summary: Minor code cleanup.

Reviewed By: yfeldblum

Differential Revision: D10430502

fbshipit-source-id: d4892baf695089458295550767b3eca1af20ca32
parent 288e58f2
...@@ -52,12 +52,6 @@ class FOLLY_EXPORT AsyncSocketException : public std::runtime_error { ...@@ -52,12 +52,6 @@ class FOLLY_EXPORT AsyncSocketException : public std::runtime_error {
type_(type), type_(type),
errno_(errnoCopy) {} errno_(errnoCopy) {}
/** Error code */
AsyncSocketExceptionType type_;
/** A copy of the errno. */
int errno_;
AsyncSocketExceptionType getType() const noexcept { AsyncSocketExceptionType getType() const noexcept {
return type_; return type_;
} }
...@@ -76,6 +70,12 @@ class FOLLY_EXPORT AsyncSocketException : public std::runtime_error { ...@@ -76,6 +70,12 @@ class FOLLY_EXPORT AsyncSocketException : public std::runtime_error {
AsyncSocketExceptionType type, AsyncSocketExceptionType type,
const std::string& message, const std::string& message,
int errnoCopy); int errnoCopy);
/** Error code */
AsyncSocketExceptionType type_;
/** A copy of the errno. */
int errno_;
}; };
} // namespace folly } // namespace folly
...@@ -177,9 +177,9 @@ class ExpectWriteErrorCallback : public WriteCallbackBase { ...@@ -177,9 +177,9 @@ class ExpectWriteErrorCallback : public WriteCallbackBase {
~ExpectWriteErrorCallback() override { ~ExpectWriteErrorCallback() override {
EXPECT_EQ(STATE_FAILED, state); EXPECT_EQ(STATE_FAILED, state);
EXPECT_EQ( EXPECT_EQ(
exception.type_, exception.getType(),
AsyncSocketException::AsyncSocketExceptionType::NETWORK_ERROR); AsyncSocketException::AsyncSocketExceptionType::NETWORK_ERROR);
EXPECT_EQ(exception.errno_, 22); EXPECT_EQ(exception.getErrno(), 22);
// Suppress the assert in ~WriteCallbackBase() // Suppress the assert in ~WriteCallbackBase()
state = STATE_SUCCEEDED; state = STATE_SUCCEEDED;
} }
......
...@@ -3143,7 +3143,8 @@ TEST(AsyncSocketTest, ErrMessageCallback) { ...@@ -3143,7 +3143,8 @@ TEST(AsyncSocketTest, ErrMessageCallback) {
ASSERT_FALSE(socket->isClosedByPeer()); ASSERT_FALSE(socket->isClosedByPeer());
// Check for the timestamp notifications. // Check for the timestamp notifications.
ASSERT_EQ(errMsgCB.exception_.type_, folly::AsyncSocketException::UNKNOWN); ASSERT_EQ(
errMsgCB.exception_.getType(), folly::AsyncSocketException::UNKNOWN);
ASSERT_GT(errMsgCB.gotByteSeq_, 0); ASSERT_GT(errMsgCB.gotByteSeq_, 0);
ASSERT_GT(errMsgCB.gotTimestamp_, 0); ASSERT_GT(errMsgCB.gotTimestamp_, 0);
ASSERT_EQ( ASSERT_EQ(
......
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