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

Adds spec for getObject on missing key #682

Merged
merged 3 commits into from
Apr 6, 2018

Conversation

solsson
Copy link
Contributor

@solsson solsson commented Apr 4, 2018

I couldn't find a spec for this. I think it's common to have to handle this error in a specific way.

client.getObject(bucketName, 'an-object-that-does-not-exist', (e, stream) => {
if (e) {
if (e.code === 'NoSuchKey') return done();
console.error('Unexpected error code', e.code, typeof e.code, e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return done(new Error("expected NoSuchKey error")

});
stream.on('end', () => {
done(new Error('Got end event on non-existent object'));
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+        stream.on('readable', () => {
+          done(new Error('Got readable event on non-existent object'));
+        });
+        stream.on('data', data => {
+          done(new Error('Got data event on non-existent object'));
+        });
+        stream.on('error', () =>  {
+          done(new Error('Got error event on non-existent object (but falsy error argument)'));
+        });
+        stream.on('end', () => {
+          done(new Error('Got end event on non-existent object'));
+        })

replace this with:

return done(new Error("object should not exist"))

@kannappanr
Copy link
Contributor

@solsson Please remove the extra semicolon at line 367. 367:15 error Extra semicolon semi. Travis and Appveyor are failing.

@kannappanr kannappanr merged commit f9ed64b into minio:master Apr 6, 2018
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

Successfully merging this pull request may close these issues.

3 participants