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

Unified Diff: remoting/webapp/base/js/error.js

Issue 1410563006: [Chromoting] SessionLogger refactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/webapp/base/js/error.js
diff --git a/remoting/webapp/base/js/error.js b/remoting/webapp/base/js/error.js
index 697fde787965d21e978efc6cf3919287b3fdc57e..13e6181dfbd12fcdd1d198cff2745f4ce406f7e8 100644
--- a/remoting/webapp/base/js/error.js
+++ b/remoting/webapp/base/js/error.js
@@ -37,8 +37,10 @@ remoting.Error.prototype.toString = function() {
/**
* @return {remoting.ChromotingEvent.ConnectionError} error
+ *
+ * @private
*/
-remoting.Error.prototype.toConnectionError = function() {
+remoting.Error.prototype.toConnectionError_ = function() {
var Tag = remoting.Error.Tag;
var ConnectionError = remoting.ChromotingEvent.ConnectionError;
switch (this.tag_) {
@@ -102,6 +104,29 @@ remoting.Error.prototype.getDetail = function() {
};
/**
+ * Populates the corresponding field in the |logEntry| based on the error tag.
+ *
+ * @param {remoting.ChromotingEvent} logEntry
+ */
+remoting.Error.prototype.fillLogEntry = function(logEntry) {
+ logEntry.connection_error = this.toConnectionError_();
+
+ var Tag = remoting.Error.Tag;
+ var detail = /** @type{string} */ (this.getDetail());
kelvinp 2015/11/07 04:44:11 This extra variable is needed to cast getDetail()
Jamie 2015/11/09 18:46:02 Nit: Space after "@type"
kelvinp 2015/11/09 22:59:10 Done.
+
+ switch (this.tag_) {
+ case Tag.HOST_IS_OFFLINE:
+ if (detail) {
+ logEntry.xmpp_error = new remoting.ChromotingEvent.XmppError(detail);
+ }
+ break;
+ case Tag.MISSING_PLUGIN:
+ console.assert(detail, 'Missing PNaCl plugin last error string.');
+ logEntry.raw_plugin_error = detail;
+ }
+};
+
+/**
* Checks the type of an error.
* @param {remoting.Error.Tag} tag
* @param {...remoting.Error.Tag} var_args

Powered by Google App Engine
This is Rietveld 408576698