A lightweight Python package for structured and readable exception details.
Project description
Errorify
Errorify is a lightweight Python package that helps you format and display exception details in a clean, structured, and readable way. It captures essential information - such as the exception type, message, file path, line number, and a timestamp - making debugging simpler and logs more meaningful.
Installation
Install Errorify directly from PyPI:
pip install errorify
Usage
To use Errorify, import it and pass the caught exception object (error) into the errorify() function.
It will return a formatted string containing all relevant exception details.
Example 1 - Basic Usage
from errorify import errorify
try:
raise ValueError("Invalid value")
except Exception as e:
print(errorify(e))
Example Output
-------------------------------- Error Details --------------------------------
Timestamp: 2025-10-12 18:45:20 +0000
Exception Name: ValueError
Exception Message: Invalid value
Exception File Path: /home/user/Documents/test.py
Exception File Name: test.py
Exception File Line Number: 4
Error File Path: /home/user/Documents/test.py
Error File Name: test.py
Error Function Name: <module>
Error File Line Number: 4
-------------------------------------------------------------------------------
Example 2 - With Custom Timezone
You can specify a timezone offset in hours using the tz_offset parameter.
This is useful when running code on a server (UTC) but you want local timestamps in logs.
from errorify import errorify
try:
1 / 0
except Exception as e:
print(errorify(e, tz_offset=+6))
Example Output
-------------------------------- Error Details --------------------------------
Timestamp: 2025-10-12 23:45:20 +0600
Exception Name: ZeroDivisionError
Exception Message: division by zero
Exception File Path: /home/user/Documents/test.py
Exception File Name: test.py
Exception File Line Number: 4
Error File Path: /home/user/Documents/test.py
Error File Name: test.py
Error Function Name: <module>
Error File Line Number: 4
-------------------------------------------------------------------------------
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
error |
BaseException |
Required | The caught exception object. |
tz_offset |
int / float / None |
None |
Timezone offset in hours (e.g. +6, -5.5, +3.5). Defaults to UTC if not provided. |
timestamp_format |
str |
"%Y-%m-%d %H:%M:%S %z" |
Datetime format for the timestamp (standard strftime format). |
Example Integration
You can use Errorify inside larger applications or logging systems to generate readable error summaries:
from errorify import errorify
def divide(a, b):
return a / b
try:
divide(5, 0)
except Exception as e:
# Print or log formatted error details
print(errorify(e, tz_offset=+5.5))
Output:
-------------------------------- Error Details --------------------------------
Timestamp: 2025-10-12 22:15:42 +0530
Exception Name: ZeroDivisionError
Exception Message: division by zero
Exception File Path: /home/user/project/app.py
Exception File Name: app.py
Exception File Line Number: 7
Error File Path: /home/user/project/app.py
Error File Name: app.py
Error Function Name: divide
Error File Line Number: 7
-------------------------------------------------------------------------------
Notes
errorify()should always be called inside anexceptblock.- Works across Linux, macOS, and Windows.
- No external dependencies - pure Python standard library.
- Safe for production logging, debugging, or error reporting systems.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Bipu Mirza 📧 bipumirja@gmail.com 🔗 GitHub: bipni
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file errorify-0.0.2.tar.gz.
File metadata
- Download URL: errorify-0.0.2.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29306f60d1bad901b78bdc9d8e5a36c0e0da7ee60cf230f51a73acf8b24a689e
|
|
| MD5 |
49016969bfeacd410098da1b0478a125
|
|
| BLAKE2b-256 |
b545cc819ece469e1be93e40438b357cbb14ac0545445b6f76e6e3718be5bf31
|
File details
Details for the file errorify-0.0.2-py3-none-any.whl.
File metadata
- Download URL: errorify-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
261a929da5b562cb999ca4b59810aec579b78fe24489795773cb88d4358ad29c
|
|
| MD5 |
f86e0f97b712d53c3c9ac52316ae35c3
|
|
| BLAKE2b-256 |
c2190bf24fff548881b3445a47163a08c8e58774d57377e79dd609c474e979fd
|