High level methods should check status codes and parse errors
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 283
- PR merge metrics
- No merged PRs in 30d
Description
See #59 and #113. In short, things like this:
``` js
var client = knox.createClient({
key: 'ABCGARBAGE',
secret: 'UTTERLYSHOULDNEVERWORK',
bucket: 'mybucket'
});
var putReq = client.putFile(source, dest, function(e, res){
assert(e !== null);
});
```
should give `e !== null`, with a useful description in the error message, instead of relying on the user to check `res.statusCode`.
Things to be aware of:
- This will require XML parsing, but we have an xml2js dependency now to take care of that.
- There are more success codes than 200; in particular anything in the 2xx range is success, and you could argue that anything in the 3xx range is also (but see #66).
- [Dynode's implementation](https://github.com/Wantworthy/dynode/blob/c29ab5c5a110c86f82329f49289647cd7a057bc9/lib/dynode/request.js#L41-54)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing high-level methods such as putFile and inspect the existing xml2js dependency for response parsing. Compare Dynode's implementation and the guidance in #59, #113, and #66; done means non-2xx responses reach the callback as errors with useful messages while 2xx responses remain successful.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100