github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/command/translatableerror/missing_credentials_error.go (about) 1 package translatableerror 2 3 type MissingCredentialsError struct { 4 MissingUsername bool 5 MissingPassword bool 6 } 7 8 func (MissingCredentialsError) DisplayUsage() {} 9 10 func (e MissingCredentialsError) Error() string { 11 switch { 12 case e.MissingUsername && !e.MissingPassword: 13 return "Username not provided." 14 case !e.MissingUsername && e.MissingPassword: 15 return "Password not provided." 16 default: 17 return "Username and password not provided." 18 } 19 } 20 21 func (e MissingCredentialsError) Translate(translate func(string, ...interface{}) string) string { 22 return translate(e.Error()) 23 }