Metadata-Version: 2.1
Name: msgfy
Version: 0.0.1
Summary: msgfy is a Python library for convert Exception instance to a human-readable error message.
Home-page: https://github.com/thombashi/msgfy
Author: Tsuyoshi Hombashi
Author-email: tsuyoshi.hombashi@gmail.com
License: MIT License
Project-URL: Documentation, http://msgfy.rtfd.io/
Project-URL: Tracker, https://github.com/thombashi/msgfy/issues
Keywords: error
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides-Extra: release
Provides-Extra: test
Provides-Extra: build
Requires-Dist: setuptools (>=38.3.0)
Provides-Extra: build
Requires-Dist: wheel; extra == 'build'
Provides-Extra: release
Requires-Dist: releasecmd (>=0.0.9); extra == 'release'
Provides-Extra: test
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: tox; extra == 'test'

msgfy
====================================
.. image:: https://badge.fury.io/py/msgfy.svg
    :target: https://badge.fury.io/py/msgfy

.. image:: https://img.shields.io/travis/thombashi/msgfy/master.svg?label=Linux
    :target: https://travis-ci.org/thombashi/msgfy

.. image:: https://img.shields.io/appveyor/ci/thombashi/msgfy/master.svg?label=Windows
    :target: https://ci.appveyor.com/project/thombashi/msgfy


Summary
====================================
msgfy is a Python library for convert Exception instance to a human-readable error message.


Usage
====================================
:Sample Code:
    .. code:: python

        import msgfy

        def main():
            try:
                raise ValueError("example message")
            except ValueError as e:
                print(msgfy.to_error_message(e))

        main()

:Output:
    ::

        ValueError error_message_basic.py(19) main: example message

Specify message format
------------------------------------
:Sample Code:
    .. code:: python

        import msgfy

        def main():
            try:
                raise ValueError("example message")
            except ValueError as e:
                print(msgfy.to_error_message(e, "{func_name}: {error_msg}"))

        main()

:Output:
    ::

        main: example message


Available keywords for message formats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+---------------------+-----------------------------------------------+
| Keyword             | Replaced to                                   |
+=====================+===============================================+
| ``"{exception}"``   | Exception class name                          |
+---------------------+-----------------------------------------------+
| ``"{file_name}"``   | File name that exception raised               |
+---------------------+-----------------------------------------------+
| ``"{line_no}"``     | Line number where the exception raised        |
+---------------------+-----------------------------------------------+
| ``"{func_name}"``   | Function name that exception raised           |
+---------------------+-----------------------------------------------+
| ``"{error_msg}"``   | Message that passed to the exception instance |
+---------------------+-----------------------------------------------+


Installation
====================================
::

    pip install msgfy

Dependencies
====================================
Python 2.7+ or 3.4+

Test dependencies
-----------------
- `pytest <http://pytest.org/latest/>`__
- `pytest-runner <https://pypi.python.org/pypi/pytest-runner>`__
- `tox <https://testrun.org/tox/latest/>`__


