Remove unneeded switch labels

This commit is contained in:
Noah Zalev 2021-07-10 22:59:08 -04:00
parent ad6ff11413
commit 65ad724546

View File

@ -553,21 +553,16 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
var commandHandler = serverCommands[command.action]; var commandHandler = serverCommands[command.action];
if (commandHandler != null) { if (commandHandler != null) {
try { commandHandler(command); return; try { commandHandler(command); return; }
} catch (e) { catch (e) {
console.log('Unhandled error while processing ' + command.action + ' for user ' + user.name + ':\n' + e); console.log('Unhandled error while processing ' + command.action + ' for user ' + user.name + ':\n' + e);
parent.parent.logError(e.stack); parent.parent.logError(e.stack); return; // todo: remove returns when switch is gone
return;
} }
} else { } else { }
// console.log('Unknown action from user ' + user.name + ': ' + command.action + '.'); // 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) { switch (command.action) {
// Avoid logging 'Unknown action...' for refactored commands
case 'lastconnect':
case 'serverconsole':
case 'pong': { break; } // NOP case 'pong': { break; } // NOP
case 'ping': { try { ws.send('{action:"pong"}'); } catch (ex) { } break; } case 'ping': { try { ws.send('{action:"pong"}'); } catch (ex) { } break; }
case 'intersession': case 'intersession':