AttractError, so instanceof AttractError
catches anything the SDK throws.
The classes
All exported from@fetchski/attract-cms-sdk; check with instanceof.
siteMessage
The site’s own words: what it refused and how to fix it. Show it to people when it says more than
the error’s name.
reason
The client’s words when the site’s are missing. It names hosts and settings: for logs and
developers, never for people.
site, method, path (no query), status, errorName, data, response and
body. Log its message, which leads with whichever of the two is set.
A few mistakes are thrown before any call: a bad client option (
SiteConfigurationError), a missing
or empty required argument (RequestNotSent, naming the route, GET /api/v1/@apostrophecms/blog/{_id}),
a slug no site has (UnknownSite), all AttractErrors, and a misused request() (a TypeError).What is retried
A call that failed in a way that is safe to repeat is sent again, so your app never has to.Rate limits
Any method. Waits
Retry-After (1 s when unsaid); a wait over a minute is thrown for you to schedule.Reads
No answer, or a 502, 503 or 504: after 0.5 s, then 1 s.
Writes
Only when they never reached the site. Never after a timeout or a 5xx.
retries (2 by default) caps the extra attempts, and 0 turns them off. Each attempt is signed afresh.
Next: paging
One loop over a whole list.