Fix SoL open in new tab Safari bug

Wrapped WebSocket constructor in try/catch block to avoid
compile errors in controller.

Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I38fbc1e5898b0b70d8a16e3f16a244e04e18347e
diff --git a/app/common/directives/serial-console.js b/app/common/directives/serial-console.js
index 4324708..27917a5 100644
--- a/app/common/directives/serial-console.js
+++ b/app/common/directives/serial-console.js
@@ -91,16 +91,20 @@
             term.setOption('theme', SOL_THEME);
             var hostname = dataService.getHost().replace('https://', '');
             var host = 'wss://' + hostname + '/console0';
-            var ws = new WebSocket(host);
-            term.attach(ws);
-            ws.onopen = function() {
-              console.log('websocket opened');
-            };
-            ws.onclose = function(event) {
-              console.log(
-                  'websocket closed. code: ' + event.code +
-                  ' reason: ' + event.reason);
-            };
+            try {
+              var ws = new WebSocket(host);
+              term.attach(ws);
+              ws.onopen = function() {
+                console.log('websocket opened');
+              };
+              ws.onclose = function(event) {
+                console.log(
+                    'websocket closed. code: ' + event.code +
+                    ' reason: ' + event.reason);
+              };
+            } catch (error) {
+              console.log(JSON.stringify(error));
+            }
             $scope.openTerminalWindow = function() {
               $window.open(
                   '#/server-control/remote-console-window',