diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2020-02-29 08:22:34 +0000 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2020-02-29 08:22:34 +0000 |
| commit | c0b3f3b78aff46e56aff9b9c091b6f04572107f1 (patch) | |
| tree | 5be5a26038aa7a4f886903fe3fef1bbcc7b16f3c /internal/server | |
| parent | 7911b102171309dfc43bc2faccac6de9e490f175 (diff) | |
better error messages
Diffstat (limited to 'internal/server')
| -rw-r--r-- | internal/server/handlers/controlhandler.go | 2 | ||||
| -rw-r--r-- | internal/server/handlers/serverhandler.go | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/internal/server/handlers/controlhandler.go b/internal/server/handlers/controlhandler.go index a33a78b..daa9835 100644 --- a/internal/server/handlers/controlhandler.go +++ b/internal/server/handlers/controlhandler.go @@ -87,6 +87,6 @@ func (h *ControlHandler) handleCommand(ctx context.Context, command string) { case "debug": h.serverMessages <- logger.Debug(h.user, "Receiving debug command", command, s) default: - h.serverMessages <- logger.Warn(h.user, "Received unknown command", command, s) + h.serverMessages <- logger.Warn(h.user, "Received unknown control command", command, s) } } diff --git a/internal/server/handlers/serverhandler.go b/internal/server/handlers/serverhandler.go index 819cddd..ba3a78e 100644 --- a/internal/server/handlers/serverhandler.go +++ b/internal/server/handlers/serverhandler.go @@ -233,7 +233,7 @@ func (h *ServerHandler) handleControlCommand(argc int, args []string) { case "debug": h.send(h.serverMessages, logger.Debug(h.user, "Receiving debug command", argc, args)) default: - logger.Warn(h.user, "Received unknown command", argc, args) + logger.Warn(h.user, "Received unknown control command", argc, args) } } @@ -248,7 +248,7 @@ func (h *ServerHandler) handleUserCommand(ctx context.Context, argc int, args [] } splitted := strings.Split(args[0], ":") - command := splitted[0] + commandName := splitted[0] // TODO: Refactor: Create an "options" clase, combine makeOptions and readOptions there. options, err := readOptions(splitted[1:]) @@ -258,7 +258,7 @@ func (h *ServerHandler) handleUserCommand(ctx context.Context, argc int, args [] return } - switch command { + switch commandName { case "grep", "cat": command := newReadCommand(h, omode.CatClient) h.incrementActiveCommands() @@ -369,7 +369,7 @@ func (h *ServerHandler) handleUserCommand(ctx context.Context, argc int, args [] finished() default: - h.sendServerMessage(logger.Error(h.user, "Received unknown command", argc, args)) + h.sendServerMessage(logger.Error(h.user, "Received unknown user command", commandName, argc, args, options)) finished() } } |
