Java-like exception declarations for python methods
Project description
PyCatch
PyCatch allows Java-like exception declarations for python methods.
Introduces throws decorator and Catch context manager and raises
UncheckedExceptionError if declared exception is not handled.
Usage
from pycatch import throws
@throws(ZeroDivisionError)
def divide(x, y):
return x / y
divide(3, 2) # raises UncheckedExceptionError: ZeroDivisionError
from pycatch import Catch, throws
@throws(ZeroDivisionError)
def divide(x, y):
return x / y
with Catch(ZeroDivisionError):
divide(3, 2) # no exceptions
from pycatch import Catch, handlers, throws
@throws(ZeroDivisionError)
def divide(x, y):
return x / y
with Catch(ZeroDivisionError, handler=handlers.pass_):
divide(3, 0) # still no exceptions
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
pycatch-0.0.1.tar.gz
(4.1 kB
view details)
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 pycatch-0.0.1.tar.gz.
File metadata
- Download URL: pycatch-0.0.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89b96ab3d0be0692f2a7cb17bd3cbb83c7b2aa5b5219dc184ca8ffe0895a688f
|
|
| MD5 |
0e54666f82ff7a246a60e7ced4f3eb82
|
|
| BLAKE2b-256 |
26e0dab380adf93c2746041d3c48825485dca79449a63a3f8c24ce129c461402
|
File details
Details for the file pycatch-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pycatch-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7b2cf4c0340949ab7a3853854e931236516ea8490a87c8122a19a4e33001200
|
|
| MD5 |
8f2fb03300a7d238c0a3a6f66d8802fb
|
|
| BLAKE2b-256 |
6f750f537838af297528153a7265c788f151a5f108a13de6c7ac7e6d24178341
|