Summary
msgfy is a Python library for convert Exception instance to a human-readable error message.
Usage
Convert from Exception instance to an error message
- Sample Code:
import msgfy def error_message_example(): try: raise ValueError("example message") except ValueError as e: print(msgfy.to_error_message(e)) error_message_example()- Output:
ValueError: example error message
Specify message format
- Sample Code:
import msgfy def error_message_format_example(): try: raise ValueError("example error message") except ValueError as e: print(msgfy.to_error_message(e, "{exception} {func_name}: {error_msg}")) error_message_format_example()- Output:
ValueError error_message_format_example: example error message
Convert from Exception instance to a debug message
- Sample Code:
import msgfy def debug_message_example(): try: raise ValueError("example debug message") except ValueError as e: print(msgfy.to_debug_message(e)) debug_message_example()- Output:
ValueError <ipython-input-4-bdd569af197b>(5) debug_message_example: example debug 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
Install from PyPI
pip install msgfy
Install from PPA (for Ubuntu)
sudo add-apt-repository ppa:thombashi/ppa sudo apt update sudo apt install python3-msgfy
Dependencies
Python 3.7+ No external dependencies.
Test dependencies
Metadata
Release files for msgfy 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| msgfy-0.2.1.tar.gz | 6.1 kB | Without provenance | Details for msgfy-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| msgfy-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for msgfy-0.2.1-py3-none-any.whl |
Total release size: 10.5 kB
Release files / msgfy-0.2.1.tar.gz
| Download URL | msgfy-0.2.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
161024732591444cc05ca3982a010005932005ec861467dead49349447a91671
|
|
BLAKE2b-256 checksum How to use checksums |
510eb78151a63e8c5cab745e90ed7b4a741dba5439a8538636bf6a5da72bad23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / msgfy-0.2.1-py3-none-any.whl
| Download URL | msgfy-0.2.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6d12d963c3cec96359884fc598ae7f84f528de830bf55c9ccf3099a482ac63c
|
|
BLAKE2b-256 checksum How to use checksums |
35564563d668b18fe22fe4999347993e3120c72d5ce3c63e4b44e7fea770eccf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for msgfy 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.