Skip to main content

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

Project description

msgfy

https://badge.fury.io/py/msgfy.svg https://img.shields.io/travis/thombashi/msgfy/master.svg?label=Linux https://img.shields.io/appveyor/ci/thombashi/msgfy/master.svg?label=Windows

Summary

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

Usage

Sample Code:
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:
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

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

msgfy-0.0.1.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

msgfy-0.0.1-py2.py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 2 Python 3

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