Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors are not captured for putFile() requests #113

Closed
oliverlloyd opened this issue Nov 5, 2012 · 1 comment
Closed

Errors are not captured for putFile() requests #113

oliverlloyd opened this issue Nov 5, 2012 · 1 comment

Comments

@oliverlloyd
Copy link

The code below should fail, I am sending invalid credentials but e is null and I am forced to read the res object to get the statusCode value which, incidentally, is correctly set as 403.

var client = knox.createClient({
            key: 'ABCGARBAGE'
          , secret: 'UTTERLYSHOULDNEVERWORK'
          , bucket: 'mybucket'
});

var putReq = client.putFile(source, dest, function(e, res){
                console.log(e)...
@domenic
Copy link
Contributor

domenic commented Nov 5, 2012

Knox does not actually handle HTTP errors. From its perspective, the request completed successfully; you would get e !== null if there were some kind of network problem, for example. You'll notice the first few examples in the readme check the status code against 200 as well.

That said, I agree this is not as user-friendly as it could be. See #59. I think I'll close both this and that one and open a new, better-named bug to track this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants