Add some debugging

This commit is contained in:
Andre Medeiros 2021-07-13 14:22:41 -04:00
parent d2909b8003
commit c2e3b81830
2 changed files with 2 additions and 3 deletions

View file

@ -19,7 +19,7 @@ func APICmd(ctx context.Context) *cobra.Command {
Args: cobra.ExactArgs(0), Args: cobra.ExactArgs(0),
Short: "Runs the RESTful API.", Short: "Runs the RESTful API.",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
port = 400 port = 4000
if os.Getenv("PORT") != "" { if os.Getenv("PORT") != "" {
port, _ = strconv.Atoi(os.Getenv("PORT")) port, _ = strconv.Atoi(os.Getenv("PORT"))
} }

View file

@ -115,10 +115,9 @@ func (rac *AuthenticatedClient) request(r *Request) ([]byte, error) {
rac.statsd.Incr("reddit.api.errors", r.tags, 0.1) rac.statsd.Incr("reddit.api.errors", r.tags, 0.1)
return nil, err return nil, err
} }
if resp.StatusCode != 200 { if resp.StatusCode != 200 {
rac.statsd.Incr("reddit.api.errors", r.tags, 0.1) rac.statsd.Incr("reddit.api.errors", r.tags, 0.1)
fmt.Println(bb) // TODO remove
// Try to parse a json error. Otherwise we generate a generic one // Try to parse a json error. Otherwise we generate a generic one
rerr := &Error{} rerr := &Error{}
if jerr := json.Unmarshal(bb, rerr); jerr != nil { if jerr := json.Unmarshal(bb, rerr); jerr != nil {