-
Notifications
You must be signed in to change notification settings - Fork 3
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
[DEVOPS-1997] -- add key to error message #70
Conversation
now error message looks like this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Hinling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Some small comments.
@@ -34,12 +34,16 @@ def get_doc(bucket, document) | |||
@cache[bucket][document] ||= begin | |||
@s3.get_object(bucket: bucket, key: document).body.read | |||
rescue Aws::S3::Errors::ServiceError => err | |||
fail "Unable to retrieve document '#{document}' from bucket '#{bucket}': " + err.message | |||
raise err, err.message + " Unable to retrieve document '#{document}' from bucket '#{bucket}'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would actually override the err.message
returned by the S3 client entirely instead of appending to it. There are multiple meanings of key
here, which could lead to confusion.
begin | ||
doc = self.get_doc(bucket, document) | ||
rescue Aws::S3::Errors::ServiceError => err | ||
fail err.message + " and the key is: #{name}. Check your variables in .yaml files." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about " for key '#{name}'. Check your data files."
for conformity with the first part of the message? It's a minor nit, but Hiera can technically support backends other than YAML.
No description provided.