From 2945e8a2b0ce9306bb049e65eb2410038e0fa18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 2 Oct 2018 19:33:52 +0200 Subject: MM-10699: Disallow renaming direct and group message channels (#9518) * MM-10699: Disallow renaming direct and group message channels * Replacing errors.New with errors.Wrapf --- cmd/mattermost/commands/channel.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/mattermost/commands/channel.go b/cmd/mattermost/commands/channel.go index 270ed6586..7fb8fea8c 100644 --- a/cmd/mattermost/commands/channel.go +++ b/cmd/mattermost/commands/channel.go @@ -4,11 +4,11 @@ package commands import ( - "errors" "fmt" "github.com/mattermost/mattermost-server/app" "github.com/mattermost/mattermost-server/model" + "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -518,7 +518,7 @@ func modifyChannelCmdF(command *cobra.Command, args []string) error { user := getUserFromUserArg(a, username) if _, err := a.UpdateChannelPrivacy(channel, user); err != nil { - return errors.New("Failed to update channel ('" + args[0] + "') privacy - " + err.Error()) + return errors.Wrapf(err, "Failed to update channel ('%s') privacy", args[0]) } return nil @@ -549,7 +549,7 @@ func renameChannelCmdF(command *cobra.Command, args []string) error { _, errch := a.RenameChannel(channel, newChannelName, newDisplayName) if errch != nil { - return errors.New("Error in updating channel from " + channel.Name + " to " + newChannelName + err.Error()) + return errors.Wrapf(errch, "Error in updating channel from %s to %s", channel.Name, newChannelName) } return nil -- cgit v1.2.3-1-g7c22