kurrik/twittergo-examples

twitter returns empty 403 bodies sometimes

jmhodges opened this issue · 1 comments

Which causes very confusing errors in resp.Parse(). Specifcally, it'll return fmt.Errorf("") because of line 199 in models.go.

I haven't figured out why it's returning 403 with empty bodies (my anaconda set up worked perfectly, so this is confusing).

Two things seem to have to happen: that error message has to be improved, and the case of empty bodies on 403s has to be handled.

The error message can be marginally improved by changing that out to

err = fmt.Errorf("unable to unmarshal Twitter error object (status code %d): %v", r.StatusCode, string(b))

but it would probably be best if that was a specific type so developers can handle it better.

Sorry, made on the wrong repo.