From 59c96413d9ddc6755a2a902d18b9423635a00c3d Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Fri, 29 Apr 2022 13:45:12 +0200 Subject: [PATCH] beautify error messages Signed-off-by: Christian Richter --- ocis-pkg/shared/errors.go | 17 +++++++++++------ ocis/pkg/init/init.go | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ocis-pkg/shared/errors.go b/ocis-pkg/shared/errors.go index de99c6bfb..bb4b5f4ec 100644 --- a/ocis-pkg/shared/errors.go +++ b/ocis-pkg/shared/errors.go @@ -7,36 +7,41 @@ import ( ) func MissingMachineAuthApiKeyError(service string) error { - return fmt.Errorf("machine_auth_api_key has not your config for %s. "+ + return fmt.Errorf("The Machineauth API key has not been configured for %s. "+ "Make sure your %s config contains the proper values "+ - "(e.g. by running ocis init or setting OCIS_MACHINE_AUTH_API_KEY)", + "(e.g. by running ocis init or setting it manually in "+ + "the config/corresponding environment variable).", service, defaults.BaseConfigPath()) } func MissingJWTTokenError(service string) error { return fmt.Errorf("jwt_secret has not been set properly in your config for %s. "+ "Make sure your %s config contains the proper values "+ - "(e.g. by running ocis init or setting OCIS_JWT_SECRET)", + "(e.g. by running ocis init or setting it manually in "+ + "the config/corresponding environment variable).", service, defaults.BaseConfigPath()) } func MissingRevaTransferSecretError(service string) error { return fmt.Errorf("transfer_secret has not been set properly in your config for %s. "+ "Make sure your %s config contains the proper values "+ - "(e.g. by running ocis init or setting STORAGE_TRANSFER_SECRET)", + "(e.g. by running ocis init or setting it manually in "+ + "the config/corresponding environment variable).", service, defaults.BaseConfigPath()) } func MissingLDAPBindPassword(service string) error { return fmt.Errorf("bind_password has not been set properly in your config for %s. "+ "Make sure your %s config contains the proper values "+ - "(e.g. by running ocis init or setting LDAP_BIND_PASSWORD)", + "(e.g. by running ocis init or setting it manually in "+ + "the config/corresponding environment variable).", service, defaults.BaseConfigPath()) } func MissingServiceUserPassword(service, serviceUser string) error { return fmt.Errorf("password of service user %s has not been set properly in your config for %s. "+ "Make sure your %s config contains the proper values "+ - "(e.g. by running ocis init or setting it via environment variable)", + "(e.g. by running ocis init or setting it manually in "+ + "the config/corresponding environment variable).", serviceUser, service, defaults.BaseConfigPath()) } diff --git a/ocis/pkg/init/init.go b/ocis/pkg/init/init.go index 61192a566..cd6c968f8 100644 --- a/ocis/pkg/init/init.go +++ b/ocis/pkg/init/init.go @@ -286,7 +286,7 @@ func CreateConfig(insecure, forceOverwrite bool, configPath string) error { return err } fmt.Printf( - "\n\n=========================================\n"+ + "\n=========================================\n"+ " generated OCIS Config\n"+ "=========================================\n"+ " configpath : %s\n"+