Skip to content

Commit

Permalink
Update arbitrary parameter error message
Browse files Browse the repository at this point in the history
- Sometimes it is unclear if the user is intending to provide a file
  path or JSON. Showing the underlying error in these cases can be
  confusing.

[#89843658]
  • Loading branch information
Gerg committed Jun 2, 2015
1 parent 2e57610 commit eea2164
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion cf/commands/service/bind_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (cmd *BindService) Run(c *cli.Context) {

paramsMap, err := json.ParseJsonFromFileOrString(params)
if err != nil {
cmd.ui.Failed("Invalid JSON provided in -c argument: " + err.Error())
cmd.ui.Failed(T("Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."))
}

cmd.ui.Say(T("Binding service {{.ServiceInstanceName}} to app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}...",
Expand Down
4 changes: 2 additions & 2 deletions cf/commands/service/bind_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ var _ = Describe("bind-service command", func() {

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
[]string{"Invalid JSON provided in -c argument: Incorrect json format: invalid character 'b' looking for beginning of value"},
[]string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."},
))
})
})
Expand Down Expand Up @@ -208,7 +208,7 @@ var _ = Describe("bind-service command", func() {

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
[]string{"Invalid JSON provided in -c argument"},
[]string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."},
))
})
})
Expand Down
2 changes: 1 addition & 1 deletion cf/commands/service/create_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (cmd CreateService) Run(c *cli.Context) {

paramsMap, err := json.ParseJsonFromFileOrString(params)
if err != nil {
cmd.ui.Failed(T("Invalid JSON provided in -c argument"))
cmd.ui.Failed(T("Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."))
}

cmd.ui.Say(T("Creating service instance {{.ServiceName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}...",
Expand Down
4 changes: 2 additions & 2 deletions cf/commands/service/create_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ var _ = Describe("create-service command", func() {

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
[]string{"Invalid JSON provided in -c argument"},
[]string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."},
))
})
})
Expand Down Expand Up @@ -166,7 +166,7 @@ var _ = Describe("create-service command", func() {

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
[]string{"Invalid JSON provided in -c argument"},
[]string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."},
))
})
})
Expand Down
2 changes: 1 addition & 1 deletion cf/commands/service/update_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (cmd *UpdateService) Run(c *cli.Context) {
params := c.String("c")
paramsMap, err := json.ParseJsonFromFileOrString(params)
if err != nil {
cmd.ui.Failed(T("Invalid JSON provided in -c argument"))
cmd.ui.Failed(T("Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."))
}

if planName != "" {
Expand Down
4 changes: 2 additions & 2 deletions cf/commands/service/update_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ var _ = Describe("update-service command", func() {

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
[]string{"Invalid JSON provided in -c argument"},
[]string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."},
))
})
})
Expand Down Expand Up @@ -207,7 +207,7 @@ var _ = Describe("update-service command", func() {

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
[]string{"Invalid JSON provided in -c argument"},
[]string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."},
))
})
})
Expand Down
2 changes: 1 addition & 1 deletion cf/commands/servicekey/create_service_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (cmd CreateServiceKey) Run(c *cli.Context) {

paramsMap, err := json.ParseJsonFromFileOrString(params)
if err != nil {
cmd.ui.Failed(T("Invalid JSON provided in -c argument"))
cmd.ui.Failed(T("Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."))
}

cmd.ui.Say(T("Creating service key {{.ServiceKeyName}} for service instance {{.ServiceInstanceName}} as {{.CurrentUser}}...",
Expand Down
4 changes: 2 additions & 2 deletions cf/commands/servicekey/create_service_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var _ = Describe("create-service-key command", func() {

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
[]string{"Invalid JSON provided in -c argument"},
[]string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."},
))
})
})
Expand Down Expand Up @@ -175,7 +175,7 @@ var _ = Describe("create-service-key command", func() {

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
[]string{"Invalid JSON provided in -c argument"},
[]string{"Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON."},
))
})
})
Expand Down
10 changes: 5 additions & 5 deletions cf/i18n/resources/de_DE.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -2604,11 +2604,6 @@
"translation": "Instance must be a non-negative integer",
"modified": false
},
{
"id": "Invalid JSON provided in -c argument",
"translation": "Invalid JSON provided in -c argument",
"modified": false
},
{
"id": "Invalid JSON response from server",
"translation": "Invalid JSON response from server",
Expand All @@ -2634,6 +2629,11 @@
"translation": "Invalid auth token: ",
"modified": false
},
{
"id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"modified": false
},
{
"id": "Invalid data from '{{.repoName}}' - plugin data does not exist",
"translation": "Invalid data from '{{.repoName}}' - plugin data does not exist",
Expand Down
10 changes: 5 additions & 5 deletions cf/i18n/resources/en_US.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -2604,11 +2604,6 @@
"translation": "Instance must be a non-negative integer",
"modified": false
},
{
"id": "Invalid JSON provided in -c argument",
"translation": "Invalid JSON provided in -c argument",
"modified": false
},
{
"id": "Invalid JSON response from server",
"translation": "Invalid JSON response from server",
Expand All @@ -2634,6 +2629,11 @@
"translation": "Invalid auth token: ",
"modified": false
},
{
"id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"modified": false
},
{
"id": "Invalid data from '{{.repoName}}' - plugin data does not exist",
"translation": "Invalid data from '{{.repoName}}' - plugin data does not exist",
Expand Down
10 changes: 5 additions & 5 deletions cf/i18n/resources/es_ES.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -2604,11 +2604,6 @@
"translation": "Instance must be a non-negative integer",
"modified": false
},
{
"id": "Invalid JSON provided in -c argument",
"translation": "Invalid JSON provided in -c argument",
"modified": false
},
{
"id": "Invalid JSON response from server",
"translation": "Respuesta JSON invalida del servidor",
Expand All @@ -2634,6 +2629,11 @@
"translation": "Token de autenticacion inválido: ",
"modified": false
},
{
"id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"modified": false
},
{
"id": "Invalid data from '{{.repoName}}' - plugin data does not exist",
"translation": "Invalid data from '{{.repoName}}' - plugin data does not exist",
Expand Down
10 changes: 5 additions & 5 deletions cf/i18n/resources/fr_FR.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -2604,11 +2604,6 @@
"translation": "Instance must be a non-negative integer",
"modified": false
},
{
"id": "Invalid JSON provided in -c argument",
"translation": "Invalid JSON provided in -c argument",
"modified": false
},
{
"id": "Invalid JSON response from server",
"translation": "Serveur JSON réponse invalide",
Expand All @@ -2634,6 +2629,11 @@
"translation": "Jeton auth invalide: ",
"modified": false
},
{
"id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"modified": false
},
{
"id": "Invalid data from '{{.repoName}}' - plugin data does not exist",
"translation": "Invalid data from '{{.repoName}}' - plugin data does not exist",
Expand Down
10 changes: 5 additions & 5 deletions cf/i18n/resources/it_IT.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -2604,11 +2604,6 @@
"translation": "Instance must be a non-negative integer",
"modified": false
},
{
"id": "Invalid JSON provided in -c argument",
"translation": "Invalid JSON provided in -c argument",
"modified": false
},
{
"id": "Invalid JSON response from server",
"translation": "Invalid JSON response from server",
Expand All @@ -2634,6 +2629,11 @@
"translation": "Invalid auth token: ",
"modified": false
},
{
"id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"modified": false
},
{
"id": "Invalid data from '{{.repoName}}' - plugin data does not exist",
"translation": "Invalid data from '{{.repoName}}' - plugin data does not exist",
Expand Down
10 changes: 5 additions & 5 deletions cf/i18n/resources/ja_JA.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -2604,11 +2604,6 @@
"translation": "Instance must be a non-negative integer",
"modified": false
},
{
"id": "Invalid JSON provided in -c argument",
"translation": "Invalid JSON provided in -c argument",
"modified": false
},
{
"id": "Invalid JSON response from server",
"translation": "Invalid JSON response from server",
Expand All @@ -2634,6 +2629,11 @@
"translation": "Invalid auth token: ",
"modified": false
},
{
"id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"modified": false
},
{
"id": "Invalid data from '{{.repoName}}' - plugin data does not exist",
"translation": "Invalid data from '{{.repoName}}' - plugin data does not exist",
Expand Down
10 changes: 5 additions & 5 deletions cf/i18n/resources/pt_BR.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -2604,11 +2604,6 @@
"translation": "Instance must be a non-negative integer",
"modified": false
},
{
"id": "Invalid JSON provided in -c argument",
"translation": "Invalid JSON provided in -c argument",
"modified": false
},
{
"id": "Invalid JSON response from server",
"translation": "Resposta JSON do servidor inválida",
Expand All @@ -2634,6 +2629,11 @@
"translation": "Token de autenticação inválido: ",
"modified": false
},
{
"id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"modified": false
},
{
"id": "Invalid data from '{{.repoName}}' - plugin data does not exist",
"translation": "Invalid data from '{{.repoName}}' - plugin data does not exist",
Expand Down
10 changes: 5 additions & 5 deletions cf/i18n/resources/zh_Hans.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -2604,11 +2604,6 @@
"translation": "Instance must be a non-negative integer",
"modified": false
},
{
"id": "Invalid JSON provided in -c argument",
"translation": "Invalid JSON provided in -c argument",
"modified": false
},
{
"id": "Invalid JSON response from server",
"translation": "无效的服务器JSON响应",
Expand All @@ -2634,6 +2629,11 @@
"translation": "无效的身份验证令牌: ",
"modified": false
},
{
"id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"modified": false
},
{
"id": "Invalid data from '{{.repoName}}' - plugin data does not exist",
"translation": "Invalid data from '{{.repoName}}' - plugin data does not exist",
Expand Down
10 changes: 5 additions & 5 deletions cf/i18n/resources/zh_Hant.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -2604,11 +2604,6 @@
"translation": "Instance must be a non-negative integer",
"modified": false
},
{
"id": "Invalid JSON provided in -c argument",
"translation": "Invalid JSON provided in -c argument",
"modified": false
},
{
"id": "Invalid JSON response from server",
"translation": "Invalid JSON response from server",
Expand All @@ -2634,6 +2629,11 @@
"translation": "Invalid auth token: ",
"modified": false
},
{
"id": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"translation": "Invalid configuration provided for -c flag. Please provide a valid JSON object or a file path containing valid JSON.",
"modified": false
},
{
"id": "Invalid data from '{{.repoName}}' - plugin data does not exist",
"translation": "Invalid data from '{{.repoName}}' - plugin data does not exist",
Expand Down

0 comments on commit eea2164

Please sign in to comment.