Create your custom errors and I have control of them with Custom Error
Project description
Custom Error
Script to throw custom errors in Python
Create your custom errors and I have control of them with Custom Error
Use
'''
Test of the module Custome Error
'''
from custom_error import Error
if __name__ == '__main__':
try:
number:float = -0.2
if number < 0.0 or number > 1.0:
raise Error("Only ranges between 0.0 and 1.0 are allowed", "Invalid Range")
except Error as e:
print(e.info())
Sintax
Error(message:str, type_error:str = '')
type_error (str): Type of the error (optional).
message (str): Error message (defaults to an empty string).
Error('My message of error', 'Type of error (optional)')
Show info of error
err = Error('Erro1') #With instance
print(err.info()) #Using method info() -> str
print(Error("Error 2", "Test").info())
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
custom_error-1.0.0.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for custom_error-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2539af765a9720183ddc4d4da4ab5561a40844c7c6900ce1ab4d481b272f81c1 |
|
MD5 | 1f9422099f8d33fb527affedc88315ef |
|
BLAKE2b-256 | a0034fe567c849d99c1be78ac390157aea012f83fb2baf499e0e3e60b23a1b37 |