diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-05-23 11:06:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-23 11:06:25 -0400 |
commit | 5c1049054eace710abd3418bbad141fbb7dd5d7f (patch) | |
tree | 24d75c14ce2aae2c6f1a8d5bc7392e958e416666 /cmd/platform/channel.go | |
parent | 69f3f2fdce4ae21a037ca61d753279efcc70f0ec (diff) | |
download | chat-5c1049054eace710abd3418bbad141fbb7dd5d7f.tar.gz chat-5c1049054eace710abd3418bbad141fbb7dd5d7f.tar.bz2 chat-5c1049054eace710abd3418bbad141fbb7dd5d7f.zip |
PLT-6471 Properly panic when translations can't be loaded (#6414)
* PLT-6471 Properly panic when translations can't be loaded
* Print usage messages when errors occur during CLI initialization
* Reverted behaviour of FindDir and added second return value to it
* Fixed merge conflict
Diffstat (limited to 'cmd/platform/channel.go')
-rw-r--r-- | cmd/platform/channel.go | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/cmd/platform/channel.go b/cmd/platform/channel.go index 218cef1d5..53daf0f9a 100644 --- a/cmd/platform/channel.go +++ b/cmd/platform/channel.go @@ -102,7 +102,9 @@ func init() { } func createChannelCmdF(cmd *cobra.Command, args []string) error { - initDBCommandContextCobra(cmd) + if err := initDBCommandContextCobra(cmd); err != nil { + return err + } if !utils.IsLicensed { return errors.New(utils.T("cli.license.critical")) @@ -152,7 +154,9 @@ func createChannelCmdF(cmd *cobra.Command, args []string) error { } func removeChannelUsersCmdF(cmd *cobra.Command, args []string) error { - initDBCommandContextCobra(cmd) + if err := initDBCommandContextCobra(cmd); err != nil { + return err + } if !utils.IsLicensed { return errors.New(utils.T("cli.license.critical")) @@ -186,7 +190,9 @@ func removeUserFromChannel(channel *model.Channel, user *model.User, userArg str } func addChannelUsersCmdF(cmd *cobra.Command, args []string) error { - initDBCommandContextCobra(cmd) + if err := initDBCommandContextCobra(cmd); err != nil { + return err + } if !utils.IsLicensed { return errors.New(utils.T("cli.license.critical")) @@ -220,7 +226,9 @@ func addUserToChannel(channel *model.Channel, user *model.User, userArg string) } func archiveChannelsCmdF(cmd *cobra.Command, args []string) error { - initDBCommandContextCobra(cmd) + if err := initDBCommandContextCobra(cmd); err != nil { + return err + } if len(args) < 1 { return errors.New("Enter at least one channel to delete.") @@ -241,7 +249,9 @@ func archiveChannelsCmdF(cmd *cobra.Command, args []string) error { } func deleteChannelsCmdF(cmd *cobra.Command, args []string) error { - initDBCommandContextCobra(cmd) + if err := initDBCommandContextCobra(cmd); err != nil { + return err + } if len(args) < 1 { return errors.New("Enter at least one channel to delete.") @@ -278,7 +288,9 @@ func deleteChannel(channel *model.Channel) *model.AppError { } func listChannelsCmdF(cmd *cobra.Command, args []string) error { - initDBCommandContextCobra(cmd) + if err := initDBCommandContextCobra(cmd); err != nil { + return err + } if !utils.IsLicensed { return errors.New(utils.T("cli.license.critical")) @@ -313,7 +325,9 @@ func listChannelsCmdF(cmd *cobra.Command, args []string) error { } func restoreChannelsCmdF(cmd *cobra.Command, args []string) error { - initDBCommandContextCobra(cmd) + if err := initDBCommandContextCobra(cmd); err != nil { + return err + } if !utils.IsLicensed { return errors.New(utils.T("cli.license.critical")) |