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

Fix error message when TCP check fails #1745

Merged
merged 2 commits into from
Jun 15, 2018
Merged

Conversation

Siecje
Copy link
Contributor

@Siecje Siecje commented Jun 14, 2018

What does this PR do?

Shows an error message instead of a traceback.

Motivation

I was getting a traceback because addr was not defined.

Review checklist

  • PR has a meaningful title or PR has the no-changelog label attached
  • Feature or bugfix has tests
  • Git history is clean
  • If PR impacts documentation, docs team has been notified or an issue has been opened on the documentation repo

Additional Notes

Anything else we should know when reviewing?

@Siecje Siecje requested a review from a team as a code owner June 14, 2018 15:41
@rishabh rishabh added this to the 6.4 milestone Jun 14, 2018
@masci
Copy link
Contributor

masci commented Jun 15, 2018

Appveyor fail unrelated to your changes, re-running the build

@@ -53,7 +53,8 @@ def _load_conf(self, instance):
addr = socket.gethostbyname(url)
socket_type = socket.AF_INET
except Exception:
raise BadConfException("URL: %s is not a correct IPv4, IPv6 or hostname" % addr)
msg = "URL: %s is not a correct IPv4, IPv6 or hostname" % url
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you use the string format method instead of %?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

I prefer .format() but the line and the rest of the file was already %, also with format it is over 79 characters. Let me know if you want me to split it up into multiple lines.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, we're trying to gradually consolidate the use of a more modern style across the codebase and I took the opportunity 😄
Line width is fine if under 120 chars.

Copy link
Contributor

@masci masci left a comment

Choose a reason for hiding this comment

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

Thanks, merging!

@masci masci merged commit 276fb8c into DataDog:master Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants