exceptions_with_structure 1.0.0__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- exceptions_with_structure-1.0.2/.gitignore +5 -0
- exceptions_with_structure-1.0.2/PKG-INFO +55 -0
- exceptions_with_structure-1.0.2/README.md +42 -0
- {exceptions_with_structure-1.0.0 → exceptions_with_structure-1.0.2}/pyproject.toml +1 -1
- exceptions_with_structure-1.0.0/src/py/__init__.py → exceptions_with_structure-1.0.2/src/py/Exceptions.py +12 -12
- exceptions_with_structure-1.0.2/src/py/__init__.py +3 -0
- exceptions_with_structure-1.0.0/.gitignore +0 -4
- exceptions_with_structure-1.0.0/PKG-INFO +0 -11
- exceptions_with_structure-1.0.0/README.md +0 -0
- {exceptions_with_structure-1.0.0 → exceptions_with_structure-1.0.2}/src/py/utils.py +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: exceptions_with_structure
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: A standardized error class with ISO-8601 timestamps and machine-readable codes.
|
|
5
|
+
Author-email: Vedansh Shetti <vedansh.shetti@gmail.com>
|
|
6
|
+
License: EUPL-1.2
|
|
7
|
+
Classifier: License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Typing :: Typed
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# exceptions_with_structure
|
|
15
|
+
|
|
16
|
+
A small Python package providing `StructuredException`, an exception with a
|
|
17
|
+
machine-readable error code and an ISO-8601 creation timestamp.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install exceptions_with_structure
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from py import StructuredException
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
raise StructuredException("File not found", "IO_ERR_404")
|
|
32
|
+
except StructuredException as error:
|
|
33
|
+
print(error)
|
|
34
|
+
print(error.error_code)
|
|
35
|
+
print(error.timestamp)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`StructuredException` accepts a human-readable `message` and an `error_code`.
|
|
39
|
+
The `timestamp` field is generated when the exception is created.
|
|
40
|
+
|
|
41
|
+
## Development
|
|
42
|
+
|
|
43
|
+
From this directory, install the package in editable mode:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install -e .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Build distributable archives with:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python -m build
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The package requires Python 3.8 or newer and is licensed under EUPL-1.2.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# exceptions_with_structure
|
|
2
|
+
|
|
3
|
+
A small Python package providing `StructuredException`, an exception with a
|
|
4
|
+
machine-readable error code and an ISO-8601 creation timestamp.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install exceptions_with_structure
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from py import StructuredException
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
raise StructuredException("File not found", "IO_ERR_404")
|
|
19
|
+
except StructuredException as error:
|
|
20
|
+
print(error)
|
|
21
|
+
print(error.error_code)
|
|
22
|
+
print(error.timestamp)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`StructuredException` accepts a human-readable `message` and an `error_code`.
|
|
26
|
+
The `timestamp` field is generated when the exception is created.
|
|
27
|
+
|
|
28
|
+
## Development
|
|
29
|
+
|
|
30
|
+
From this directory, install the package in editable mode:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install -e .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Build distributable archives with:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python -m build
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The package requires Python 3.8 or newer and is licensed under EUPL-1.2.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
from .utils import iso8601
|
|
2
|
-
|
|
3
|
-
class
|
|
4
|
-
def __init__(self, message: str, error_code: str):
|
|
5
|
-
# Pass the message to the parent Exception class
|
|
6
|
-
super().__init__(message)
|
|
7
|
-
|
|
8
|
-
# Store your custom fields
|
|
9
|
-
self.timestamp = iso8601()
|
|
10
|
-
self.error_code = error_code
|
|
11
|
-
|
|
12
|
-
__all__ = ["
|
|
1
|
+
from .utils import iso8601
|
|
2
|
+
|
|
3
|
+
class StructuredException(Exception):
|
|
4
|
+
def __init__(self, message: str, error_code: str):
|
|
5
|
+
# Pass the message to the parent Exception class
|
|
6
|
+
super().__init__(message)
|
|
7
|
+
|
|
8
|
+
# Store your custom fields
|
|
9
|
+
self.timestamp = iso8601()
|
|
10
|
+
self.error_code = error_code
|
|
11
|
+
|
|
12
|
+
__all__ = ["StructuredException"]
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: exceptions_with_structure
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: A standardized error class with ISO-8601 timestamps and machine-readable codes.
|
|
5
|
-
Author-email: Vedansh Shetti <vedansh.shetti@gmail.com>
|
|
6
|
-
License: EUPL-1.2
|
|
7
|
-
Classifier: License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)
|
|
8
|
-
Classifier: Operating System :: OS Independent
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: Typing :: Typed
|
|
11
|
-
Requires-Python: >=3.8
|
|
File without changes
|
|
File without changes
|