Remove unneeded switch labels
Noah Zalev committed
Jul 10, 2021 at 22:59 UTC
65ad72454672ab6f8750c1458ec50074e59e83f6
1 file changed
+5
-10
meshuser.js
+5
-10
@@ -553,21 +553,16 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
553
554
var commandHandler = serverCommands[command.action];
555
if (commandHandler != null) {
556
- try { commandHandler(command); return;
557
- } catch (e) {
556
+ try { commandHandler(command); return; }
557
+ catch (e) {
558
console.log('Unhandled error while processing ' + command.action + ' for user ' + user.name + ':\n' + e);
559
- parent.parent.logError(e.stack);
560
- return;
559
+ parent.parent.logError(e.stack); return; // todo: remove returns when switch is gone
560
}
562
- } else {
561
+ } else { }
562
// console.log('Unknown action from user ' + user.name + ': ' + command.action + '.');
564
- // pass through to switch statement
565
- }
563
+ // pass through to switch statement until refactoring complete
564
565
switch (command.action) {
568
- // Avoid logging 'Unknown action...' for refactored commands
569
- case 'lastconnect':
570
- case 'serverconsole':
566
case 'pong': { break; } // NOP
567
case 'ping': { try { ws.send('{action:"pong"}'); } catch (ex) { } break; }
568
case 'intersession':