Skip to content

Commit

Permalink
Fixes parsing errors from Cloud (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
TAGraves authored Dec 8, 2023
1 parent 77f249b commit a93fe3c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,12 @@ func (c Client) InitiateRun(cfg InitiateRunConfig) (*InitiateRunResult, error) {
// extractErrorMessage is a small helper function for parsing an API error message
func extractErrorMessage(reader io.Reader) string {
errorStruct := struct {
Result struct {
Data struct {
Error string
}
}
Error string
}{}

if err := json.NewDecoder(reader).Decode(&errorStruct); err != nil {
return ""
}

return errorStruct.Result.Data.Error
return errorStruct.Error
}

0 comments on commit a93fe3c

Please sign in to comment.