Closed jolivares closed 9 years ago
"empty error message" weird. I'm not sure how that would happen.
As for adding better visibility for errors and stuff. Not sure how to add that while maintaining backwards compatibility.
I noticed strava REST API returns different error message structures in case of failed uploads. So basically this code won't be able to map the response error:
if resp.StatusCode/100 == 4 {
var response Error
contents, _ := ioutil.ReadAll(resp.Body)
json.Unmarshal(contents, &response)
return response
}
This is what you get for a failed upload:
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=UTF-8
{
"id": 123456,
"external_id": "2014-03-10-19-43-05.fit",
"error": "2014-03-10-19-43-05.fit duplicate of activity 123456",
"status": "There was an error processing your activity.",
"activity_id": null
}
I've proposed a code modification to support more than one error handler: https://github.com/strava/go.strava/pull/8 Feel free to discard it if you don't like the approach, but it would be great to get the real error message.
Yes, this is a problem that needs to be fixed on the server side. As for dealing with it in this library https://github.com/strava/go.strava/pull/8 seems like a good approach and has been merged.
When trying to upload an existing activity file I get an empty error message. It's not easy to tell from the error message what happened. So it would be great if the error messages were more descriptive, and it would also be great to have the ability to log the request & response message (http status code, headers, and bodies if possible).