Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Unified Diff: remoting/protocol/errors.h

Issue 1238343002: Added ConnectionTimeObserver to calculate the times to authenticate and connect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved FriendlyString to errors.h and connection_to_host.h. Cleaned up connection_time_observer_unit… Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/errors.h
diff --git a/remoting/protocol/errors.h b/remoting/protocol/errors.h
index 7f4daf64031c6b8d4341c24da623b72bef84894a..c72d87b2fbb68fa571e471762bfe35e570eedbb4 100644
--- a/remoting/protocol/errors.h
+++ b/remoting/protocol/errors.h
@@ -5,6 +5,12 @@
#ifndef REMOTING_PROTOCOL_ERROR_H_
#define REMOTING_PROTOCOL_ERROR_H_
+#include "base/logging.h"
+
+#define RETURN_STRING_LITERAL(x) \
+case x: \
+return #x;
+
namespace remoting {
namespace protocol {
@@ -25,6 +31,28 @@ enum ErrorCode {
UNKNOWN_ERROR,
};
+class Error {
joedow 2015/07/29 17:07:02 Adding a helper method to ConnectionToHost felt fi
tonychun 2015/07/29 18:30:33 Done.
+ public:
+ static const char* ProtocolErrorToFriendlyString(ErrorCode error) {
+ switch (error) {
+ RETURN_STRING_LITERAL(OK);
+ RETURN_STRING_LITERAL(PEER_IS_OFFLINE);
+ RETURN_STRING_LITERAL(SESSION_REJECTED);
+ RETURN_STRING_LITERAL(INCOMPATIBLE_PROTOCOL);
+ RETURN_STRING_LITERAL(AUTHENTICATION_FAILED);
+ RETURN_STRING_LITERAL(CHANNEL_CONNECTION_ERROR);
+ RETURN_STRING_LITERAL(SIGNALING_ERROR);
+ RETURN_STRING_LITERAL(SIGNALING_TIMEOUT);
+ RETURN_STRING_LITERAL(HOST_OVERLOAD);
+ RETURN_STRING_LITERAL(UNKNOWN_ERROR);
+ default:
+ LOG(ERROR) << "Unknown error: '" << error << "'";
+ return "UNKNOWN ERROR";
+ }
+ }
+};
+
+
} // namespace protocol
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698