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 |