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

getObject does not return Error objects for NoSuchKey #72

Open
gabegorelick opened this issue Jul 31, 2020 · 0 comments
Open

getObject does not return Error objects for NoSuchKey #72

gabegorelick opened this issue Jul 31, 2020 · 0 comments

Comments

@gabegorelick
Copy link
Contributor

When an object doesn't exist, getObject returns an object with the requisite properties, but it's not an Error object. This makes debugging more difficult (since there's no stack property), breaks Nodejs conventions (callers typically expect the first argument to a callback to be an Error object), and deviates from the official AWS SDK (which returns Error objects).

mock-aws-s3/lib/mock.js

Lines 331 to 340 in 6b5aa02

if (err.code === 'ENOENT') {
return callback({
cfId: undefined,
code: 'NoSuchKey',
message: 'The specified key does not exist.',
name: 'NoSuchKey',
region: null,
statusCode: 404
}, search)
}

Every other method seems to correctly return Error objects. So this appears to be an outlier.

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

1 participant