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

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: Made ToString methods into functions. Made code more readable and removed multiple defines in chromoting_instance.cc 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..8b93992a2417bb95c7fcdb6de78e0d842d9cf738 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,24 @@ enum ErrorCode {
UNKNOWN_ERROR,
};
+inline const char* ErrorCodeToString(ErrorCode error) {
joedow 2015/07/29 20:09:31 remove inline
+ 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