X-Git-Url: https://git.wh0rd.org/?p=chrome-ext%2Fmusic-player-client.git;a=blobdiff_plain;f=main.js;h=3ff3ca46906251888f02af57737083d149c446e0;hp=16875983968fd05b34c142910747a369b2bb5517;hb=HEAD;hpb=ccfc12deb15558bccd7d1c5a586fef5b86d386ea diff --git a/main.js b/main.js index 1687598..3ff3ca4 100644 --- a/main.js +++ b/main.js @@ -103,7 +103,12 @@ function mpc_connect(host, port) { update_ui('init'); tcpclient = new TcpClient(host, port); - tcpclient.connect(function() { + tcpclient.connect(function(resultCode) { + if (resultCode < 0) { + update_ui('error', resultCode); + return; + } + var mpc_sender = new TcpClientSender(tcpclient); tcpclient.addResponseListener(tramp_mpc_recv); mpc = new Mpc(mpc_sender, update_ui); @@ -301,6 +306,7 @@ function update_ui(state, cmd) { ui_mpc_status.innerText = ({ 'disconnect': 'Disconnecting...', 'init': 'Connecting...', + 'error': 'Connection error ' + cmd, })[state]; return; }