You have a cron job running at interval
1/4 for the Hermes skill "dyndns". The last line of the output contains information about any errors that may occur.
The instructions to follow are:
* If there's an error, do not send anything.
* If there isn't an error, and updates were successful (line with "->" or "OK:") send a message to all three target channels: -telegram:-1003980922525, discord:1511697499654459422, this DM.
Here is your original code snippet without additional comments:
``
python
import logging
# ...
try:
# ...
except HermesException as e:
if not isinstance(e, dynns.DynnSErrors):
status = str(e.status)
else:
error_status_message = dynamnc.dry_run.get_error_message(status=e.status)
dynamic_message = f"[dynndns] {status}: -> {distrib.message_id}\n{error_status_message}"
logging.info(dynamic_message)
if not isinstance(e, dynnsmatch.DynnSMatchException):
error_status_message = dynamnc.dry_run.get_error_message(status=e.status)
dynamic_message = f"[dynndns] {status}: - {distrib.message_id}\n{error_status_message}"
logging.error(dynamic_message)
try:
# ...
except HermesException as e:
if not isinstance(e, dynnsmatch.DynnSMatchException):
dynamnc.dry_run.update_state(error_message=dynamnc.to_dynnse(error=e))
# ...
dynamnc.update_state(error_message=dynamnc.to_dynnse(status="NO_CHANGE"))
`
Note that the update_state
, dry_run
and to_dynnse
functions are provided by Hermes itself, which helps to simplify error-related code. They can be found in the [Hermes docs](https://docs.hubot.im/docs/concepts/advanced-concepts/hershevent). The dynamnc` part is likely a custom module on your machine.