Skip to main content

Decorator based error handling for Python, with light Slack coating

Project description

nurgle

https://img.shields.io/pypi/v/nurgle.svg https://img.shields.io/travis/@Herout/nurgle.svg Documentation Status

Decorator based error handling for Python, all props to merry by Miguel Grinberg. This is a naive extension of merry, and should not be used in production. Us on your own risk. Nurgle can be used in batch processing, where you need to be informed of the first run with failure and/or first run that recovered from failure.

Features

For basic information about its use case, please see original README

Nurgle is a drop-in replacement of Merry. On top of parameters provided by Merry, Nurgle object can be constructed as follows:

from nurgle import Nurgle
nurgle = Nurgle(slack_token="<your-slack-token>", slack_channel="<channel-to-write-to>", state_file="/path/to/a-file.nurgle.state")

If decorated code throws an exception

Nurgle looks for state_file in order to determine, if previous run failed as well.

  • If the file does not exist, previous run did not fail, and the exception is sent into the Slack channel.

  • If the file does exist, content is read and compared to stringified current exception. If the exception is not the same, we failed for different reason, and the exception is sent into the Slack channel.

Otherwise, exception is not sent.

If decorated code does not throw an exception

Nurgle looks for state_file in order to determine, if previous run failed or not.

  • If the file does not exist, previous run also did not fail, and nothing is sent to the Slack channel.

  • If the file does exists, previous run failed:
    • “recovery” message is sent to the Slack channel.

    • afterwards, state_file is deleted.

History

0.1.1 (2020-09-08)

  • Docs updates.

0.1.0 (2020-09-08)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nurgle-0.1.2.tar.gz (12.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page