octodns / octodns-ns1

Ns1Provider provider for octoDNS
MIT License
4 stars 13 forks source link

Added logging for ResourceException error in NS1 requests. #71

Closed jdickson0296 closed 11 months ago

jdickson0296 commented 11 months ago

Added Exception to catch ResourceException error to get more details on which specific method failed.

2023-06-01T16:11:52  [139903552284480] INFO  Ns1Provider[ns1] apply: making 1 changes to linkedin.com.
Traceback (most recent call last):
  File "/home/vsts/work/1/s/dns/env/bin/octodns-sync", line 8, in <module>
    sys.exit(main())
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/octodns/cmds/sync.py", line 57, in main
    manager.sync(
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/octodns/manager.py", line 653, in sync
    total_changes += target.apply(plan)
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/octodns/provider/base.py", line 245, in apply
    self._apply(plan)
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/octodns_ns1/__init__.py", line 1727, in _apply
    getattr(self, f'_apply_{class_name}')(ns1_zone, change)
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/octodns_ns1/__init__.py", line 1683, in _apply_Update
    self._client.records_update(zone, domain, _type, **params)
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/octodns_ns1/__init__.py", line 113, in call
    new_record = func(self, zone, domain, _type, **params)
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/octodns_ns1/__init__.py", line 254, in records_update
    return self._try(self._records.update, zone, domain, _type, **params)
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/octodns_ns1/__init__.py", line 269, in _try
    return method(*args, **kwargs)
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/ns1/rest/records.py", line 146, in update
    return self._make_request(
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/ns1/rest/resource.py", line 75, in _make_request
    return self._transport.send(type, self._make_url(path), **kwargs)
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/ns1/rest/transport/requests.py", line 112, in send
    resp_headers, jsonOut = self._send(
  File "/home/vsts/work/1/s/dns/env/lib/python3.8/site-packages/ns1/rest/transport/requests.py", line 81, in _send
    raise ResourceException("server error", resp, resp.text)
ns1.rest.errors.ResourceException: server error
##[error]Bash exited with code '1'. 
jdickson0296 commented 11 months ago

What situation were you running into this with?

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.

istr commented 11 months ago

@jdickson0296 very helpful. If I remember correctly, there was an announced maintenance window recently. And the next one is coming soon. :disappointed: