pyexcept
The perfect Python 3 library for creating new exceptions, raising custom errors with custom messages and choosing from a set of 13 unique exceptions!
pyexcept Built-in Exceptions
pyexcept contains built-in 13 Exceptions that python BaseException does not include built-in. List:
- BlockageError
- ComileError
- EncodeError
- DecodeError
- HTTPError
- HostResolveError
- IOError
- PermissionError
- RefuseError
- RunError
- TranslationError
- WebConnectionError
- FormatError
Usage example:
INPUT:
import pyexcept
raise pyexcept.PermissionError("This is an example error")
OUTPUT:
Traceback (most recent call last):
File "/home/your_name/exampleFile.py", line 3, in <module>
raise pyexcept.PermissionError("This is an example error")
_.PermissionError: This is an example error
pyexcept Create custom exception
Using the pyexcept module, you can create custom exception names and messages. Example:
INPUT:
import pyexcept
raise pyexcept.newException("MyCustomError", "This is a custom error type, not from BaseException")
OUTPUT:
Traceback (most recent call last):
File "/home/your_name/exampleFile.py", line 3 in <module>
raise pyexcept.newException("MyCustomError", "This is a custom error type, not from BaseException")
_.MyCustomError: This is a custom error type, not from BaseException
pyexception Raise full error
In pyexcept, you can use the raiser() method to create full errors. I will tell exceptions to raise an error that says the error happend on line #1 of "exampleFile.py".
Definition and Usage:
INPUT:
import pyexcept
raise pyexcept.raiser("FullError", "Raise an error", line=1, file="exampleFile.py")
OUTPUT:
Traceback (most recent call last):
File "/home/your_name/exampleFile.py", line 3 in <module>
raise pyexcept.newException("MyCustomError", "This is a custom error type, not from BaseException")
_._:
File "/home/your_name/exampleFile.py", line 1 in <module>
import pyexcept
FullError: Raise an error
Finally, raise errors from BaseException using exceptions
Usage:
INPUT:
import pyexcept
raise pyexcept.base(NameError, "This is an example")
OUTPUT:
Traceback (most recent call last):
File "/home/your_name/exampleFile.py", line 3 in <module>
raise pyexcept.base(NameError, "This is an example")
NameError: This is an example
Thank you!
Metadata
Release files for pyexcept 0.0.5
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 |
|---|---|---|---|---|
| pyexcept-0.0.5.tar.gz | 14.6 kB | Without provenance | Details for pyexcept-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyexcept-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for pyexcept-0.0.5-py3-none-any.whl |
Total release size: 30.1 kB
Release files / pyexcept-0.0.5.tar.gz
| Download URL | pyexcept-0.0.5.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2321b8a0aea400f9f1b64588cb8c198d43d27ff43cfa7b78b261fcef48abfbef
|
|
BLAKE2b-256 checksum How to use checksums |
33b251cc5458a8670302163bd7da400e8fc0ad0140bd3a2601e055894b4b7b53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6
|
Release files / pyexcept-0.0.5-py3-none-any.whl
| Download URL | pyexcept-0.0.5-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63d951513f89cc3e725194328575de35ba3ca07a7c70c5b7e01f19b0eb29c58b
|
|
BLAKE2b-256 checksum How to use checksums |
a6b9234760cc2c66fc0f73b0fdc4c5867d8d6820456ddc8b8a053fc33b22063d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6
|
Security for pyexcept 0.0.5
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.