From 65ad72454672ab6f8750c1458ec50074e59e83f6 Mon Sep 17 00:00:00 2001 From: Noah Zalev Date: Sat, 10 Jul 2021 22:59:08 -0400 Subject: [PATCH] Remove unneeded switch labels --- meshuser.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/meshuser.js b/meshuser.js index cabcc3c2..7b9fc8f2 100644 --- a/meshuser.js +++ b/meshuser.js @@ -553,21 +553,16 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var commandHandler = serverCommands[command.action]; if (commandHandler != null) { - try { commandHandler(command); return; - } catch (e) { + try { commandHandler(command); return; } + catch (e) { console.log('Unhandled error while processing ' + command.action + ' for user ' + user.name + ':\n' + e); - parent.parent.logError(e.stack); - return; + parent.parent.logError(e.stack); return; // todo: remove returns when switch is gone } - } else { + } else { } // console.log('Unknown action from user ' + user.name + ': ' + command.action + '.'); - // pass through to switch statement - } + // pass through to switch statement until refactoring complete switch (command.action) { - // Avoid logging 'Unknown action...' for refactored commands - case 'lastconnect': - case 'serverconsole': case 'pong': { break; } // NOP case 'ping': { try { ws.send('{action:"pong"}'); } catch (ex) { } break; } case 'intersession':