From bfb2640451c95b242ae7b8bb8528538b706412ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 24 Jul 2018 16:11:47 +0200 Subject: Add idiomatic error handling in mattermost commands (#9147) --- cmd/mattermost/commands/import.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'cmd/mattermost/commands/import.go') diff --git a/cmd/mattermost/commands/import.go b/cmd/mattermost/commands/import.go index 8526ba6f8..d376fd61e 100644 --- a/cmd/mattermost/commands/import.go +++ b/cmd/mattermost/commands/import.go @@ -125,7 +125,9 @@ func bulkImportCmdF(command *cobra.Command, args []string) error { if apply && validate { CommandPrettyPrintln("Use only one of --apply or --validate.") return nil - } else if apply && !validate { + } + + if apply && !validate { CommandPrettyPrintln("Running Bulk Import. This may take a long time.") } else { CommandPrettyPrintln("Running Bulk Import Data Validation.") @@ -141,12 +143,12 @@ func bulkImportCmdF(command *cobra.Command, args []string) error { CommandPrettyPrintln(fmt.Sprintf("Error occurred on data file line %v", lineNumber)) } return err + } + + if apply { + CommandPrettyPrintln("Finished Bulk Import.") } else { - if apply { - CommandPrettyPrintln("Finished Bulk Import.") - } else { - CommandPrettyPrintln("Validation complete. You can now perform the import by rerunning this command with the --apply flag.") - } + CommandPrettyPrintln("Validation complete. You can now perform the import by rerunning this command with the --apply flag.") } return nil -- cgit v1.2.3-1-g7c22