This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Python library for easily “eating” exceptions in functions. Eating can mean either returning a default value or calling another function.

Introduction

This library is basically just a function, namely hungry.eat. Initially, I wrote it for a document parser in which there was a lot of exception handling logic for stuff I didn’t really care particularly much about.

Example usage

Eat all exceptions and return None if one was raised:

@hungry.eat()
def foo():
    ...

Eat ValueError exceptions and return 0 if one was raised:

@hungry.eat(ValueError, error_value=0)
def foo():
    ...

Eat IndexError and ValueError and fall back to function bar if one of them is raised:

@hungry.eat(IndexError, ValueError, error_handler=bar)
def foo():
    ...

In the example above, bar will be passed the exception as the first argument, followed by all the other arguments and keyword arguments in the decorated function. This means that bar would have e.g. the following signature:

def bar(ex, *args, **kwargs):
    ...

Notes

This library will not catch exceptions and continue executing the following code. Whenever it eats an exception, it immediately returns error_value or calls error_handler.

TODO

Complete the test suite.

Release History

Release History

0.0.4

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting