-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Added logging for ResourceException error in NS1 requests. #71
Conversation
merging with main
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 situation were you running into this with?
octodns_ns1/__init__.py
Outdated
self.log.debug( | ||
"_try: method=%s, args=%s, error=%s", | ||
method.__name__, | ||
str(args), | ||
e.message, | ||
) |
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.
Seems reasonable. Switching the debug to an exception
and removing the e.message
bit as I believe self.log.exception
should take care of that and always print w/o having to add --debug
which makes sense for an error.
self.log.debug( | |
"_try: method=%s, args=%s, error=%s", | |
method.__name__, | |
str(args), | |
e.message, | |
) | |
self.log.exception( | |
"_try: method=%s, args=%s, error=%s", | |
method.__name__, | |
str(args), | |
) |
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.
Yeah that makes sense, I can add that change.
I would like to log the response and body to view information about the request.
except ResourceException as e:
self.log.exception(
"_try: method=%s, args=%s, response=%s, body=%s",
method.__name__,
str(args),
e.response,
e.body,
)
raise
2023-10-25T15:53:37 [13073186816] ERROR NS1Client _try: method=retrieve, args=('olinkedin.com',), response=<Response [401]>, body={"message":"Invalid NSONE Key","details":[{"type":"request-id","message":"0a9ed58c-310b-4b70-ae4d-ad7543c12d68"}]}
It was related to the NS1 API being down and the engineer on our team couldn't gather any details about the request made to share with NS1 support. |
…dy content to the log
@jdickson0296 very helpful. If I remember correctly, there was an announced maintenance window recently. And the next one is coming soon. 😞 |
Added Exception to catch ResourceException error to get more details on which specific method failed.