Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

5xx responses from API should raise a TransientError #61

@sbleon

Description

@sbleon

I would love to see 5xx responses raise a TrackerApi::TransientError to let client code handle transient errors (timeouts, etc) differently than permanent errors (auth problems, bad requests, etc). For example, I would like to retry if there is a transient error, but not if there is a permanent error.

TrackerApi::TransientError could be a child of TrackerApi::Error to preserve compatibility with existing client code.

Here are a few examples of errors our app has reported. I'm assuming that these responses were accompanied by an appropriate 5xx HTTP status code.

A TrackerApi::Error occurred in background at 2016-01-20 08:29 :

  757: unexpected token at '<h1>This website is under heavy load</h1><p>We're sorry, too many people are accessing this website at the same time. We're working on this problem. Please try again later.</p>'
  /app/vendor/bundle/ruby/2.2.0/gems/tracker_api-0.2.11/lib/tracker_api/client.rb:207:in `rescue in request'
  A TrackerApi::Error occurred in background at 2016-02-04 07:11 :

  757: unexpected token at '<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>

'
  /app/vendor/bundle/ruby/2.2.0/gems/tracker_api-0.2.11/lib/tracker_api/client.rb:207:in `rescue in request'

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions