Skip to content

Commit

Permalink
fix: Display JSON 500 error message (#235)
Browse files Browse the repository at this point in the history
The 500 error message is displayed as a pointer address instead of the
message itself. The JSON map always contains an error and a message.
  • Loading branch information
laurentluce authored Sep 20, 2024
1 parent 42f6be2 commit 1073cb5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kardinal-cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ func createDevFlow(tenantUuid api_types.Uuid, pairsMap map[string]string, templa
if resp.StatusCode() == 404 {
fmt.Printf("Could not create flow, missing %s: %s\n", resp.JSON404.ResourceType, resp.JSON404.Id)
} else if resp.StatusCode() == 500 {
fmt.Printf("Could not create flow, error %s: %v\n", resp.JSON500.Error, resp.JSON500.Msg)
fmt.Printf("Could not create flow, error %s: %s\n", resp.JSON500.Error, *resp.JSON500.Msg)
} else {
fmt.Printf("Failed to create dev flow: %s\n", string(resp.Body))
}
Expand Down Expand Up @@ -893,7 +893,7 @@ func deploy(tenantUuid api_types.Uuid, serviceConfigs []api_types.ServiceConfig,
if resp.StatusCode() == 404 {
fmt.Printf("Could not create flow, missing %s: %s\n", resp.JSON404.ResourceType, resp.JSON404.Id)
} else if resp.StatusCode() == 500 {
fmt.Printf("Could not create flow, error %s: %v\n", resp.JSON500.Error, resp.JSON500.Msg)
fmt.Printf("Could not create flow, error %s: %s\n", resp.JSON500.Error, *resp.JSON500.Msg)
} else {
fmt.Printf("Failed to create dev flow: %s\n", string(resp.Body))
}
Expand Down Expand Up @@ -974,7 +974,7 @@ func createTemplate(tenantUuid api_types.Uuid, templateName string, services []c
if resp.StatusCode() == 404 {
fmt.Printf("Could not create template, missing %s: %s\n", resp.JSON404.ResourceType, resp.JSON404.Id)
} else if resp.StatusCode() == 500 {
fmt.Printf("Could not create template, error %s: %v\n", resp.JSON500.Error, resp.JSON500.Msg)
fmt.Printf("Could not create template, error %s: %s\n", resp.JSON500.Error, *resp.JSON500.Msg)
} else {
fmt.Printf("Failed to create template: %s\n", string(resp.Body))
}
Expand Down Expand Up @@ -1016,7 +1016,7 @@ func listTemplates(tenantUuid api_types.Uuid) {
if resp.StatusCode() == 404 {
fmt.Printf("Could not list templates, missing %s: %s\n", resp.JSON404.ResourceType, resp.JSON404.Id)
} else if resp.StatusCode() == 500 {
fmt.Printf("Could not list templates, error %s: %v\n", resp.JSON500.Error, resp.JSON500.Msg)
fmt.Printf("Could not list templates, error %s: %s\n", resp.JSON500.Error, *resp.JSON500.Msg)
} else {
fmt.Printf("Failed to list templates: %s\n", string(resp.Body))
}
Expand Down

0 comments on commit 1073cb5

Please sign in to comment.