DEPRECATED
Find a file
2015-01-06 07:51:16 -05:00
docs Version bump to 1.0.0 2014-11-20 10:03:22 -05:00
sprockets Convert sprockets.mixins.json_error to a module. 2015-01-06 07:50:24 -05:00
.editorconfig Initial commit 2014-11-14 10:43:21 -05:00
.gitignore Initial commit 2014-11-14 10:43:21 -05:00
.travis.yml travis.yml: Enable container-based builds. 2015-01-06 07:50:53 -05:00
dev-requirements.txt Initial commit 2014-11-14 10:43:21 -05:00
LICENSE Initial commit 2014-11-14 10:43:21 -05:00
MANIFEST.in Initial commit 2014-11-14 10:43:21 -05:00
README.rst Fix typo in README. 2014-11-18 09:54:46 -05:00
requirements.txt Initial commit 2014-11-14 10:43:21 -05:00
setup.cfg Initial commit 2014-11-14 10:43:21 -05:00
setup.py setup.py: Use find_packages to locate packages. 2015-01-06 07:51:16 -05:00
test-requirements.txt Add JsonErrorMixin: 2014-11-14 15:27:13 -05:00
tests.py Fix Py3 encoding failures in tests.py. 2014-11-18 13:47:29 -05:00
tox.ini Add tox support. 2014-11-18 13:44:47 -05:00

sprockets.mixins.json_error
===========================
Handler mixin for writing JSON errors

|Version| |Downloads| |Status| |Coverage| |License|

Installation
------------
``sprockets.mixins.json_error`` is available on the
`Python Package Index <https://pypi.python.org/pypi/sprockets.mixins.json_error>`_
and can be installed via ``pip`` or ``easy_install``:

.. code:: bash

  pip install sprockets.mixins.json_error

Documentation
-------------
https://sprocketsmixinsjson_error.readthedocs.org

Requirements
------------
-  `sprockets <https://github.com/sprockets/sprockets>`_

Example
-------
This examples demonstrates how to use ``sprockets.mixins.json_error`` to format
errors as JSON.

.. code:: python

    from sprockets import mixins.json_error
    from tornado import web

    class MyRequestHandler(json_error.JsonErrorMixin,
                           web.RequestHandler):

        def get(self, *args, **kwargs):
            raise web.HTTPError(404, log_message='My reason')


The response from the handler will automatically be formatted as:

.. code:: json

    {
        "message": "My reason",
        "type": "Not Found"
    }


Version History
---------------
Available at https://sprocketsmixinsjson_error.readthedocs.org/en/latest/history.html

.. |Version| image:: https://badge.fury.io/py/sprockets.mixins.json_error.svg?
   :target: http://badge.fury.io/py/sprockets.mixins.json_error

.. |Status| image:: https://travis-ci.org/sprockets/sprockets.mixins.json_error.svg?branch=master
   :target: https://travis-ci.org/sprockets/sprockets.mixins.json_error

.. |Coverage| image:: https://img.shields.io/coveralls/sprockets/sprockets.mixins.json_error.svg?
   :target: https://coveralls.io/r/sprockets/sprockets.mixins.json_error

.. |Downloads| image:: https://pypip.in/d/sprockets.mixins.json_error/badge.svg?
   :target: https://pypi.python.org/pypi/sprockets.mixins.json_error

.. |License| image:: https://pypip.in/license/sprockets.mixins.json_error/badge.svg?
   :target: https://sprocketsmixinsjson_error.readthedocs.org