Skip to main content

Easy-to-use custom error/warning/message exceptions.

Project description

# easyexception

Conveniently submit and print an error, warning, or message from your codes, and specify where the error, warning, or message came from.

### Purpose When one raise an exception in his/her program, or throws a warning, on the screen it is often unclear where the error/warning/message was initiated. This makes it hard for users of the program to troubleshoot the problem.

In easyexception, this is solved by a simple trick, we combine all kinds of screen messages into one function: easyexception(origin, code, severity, msg)where severity can be “Error”, “Warning”, or “Message”

### Usage To use the easyexception function, import it in Python:

from easyexception.exception import easyexception

The program developer just calls the function to define the above information and deliver the message to the user screen. e.g. if you are developing a calculator program and the user puts in a negative number and then presses “Square Root”. You want to throw a warning but not to stop the program, you may do:

easyexception(“mymath.py”, “calculate_sqrt(n)”, “Warning”, “Can not give the square root for a negative number”)

The above assumes easyexception is called in function calculate_sqrt(n) in file mymath.py.

Or, if the user magically puts some texts in the input bar, and you hate it so much that you would like to raise an Error and stop the program. You may then do:

easyexception(“get_user_input.py”, “eval_expr(eq)”, “Error”, “Texts are not allowed in the input bar!”)

Similarly, the above assumes easyexception is called in function eval_expr(eq) in file get_user_input.py.

Finally, severity=”Message” can be used if you want to notify the user that a calculation is complete, or the user has cleared the memory, etc.

### Installation Install easyexception using pip, or pip3

pip install easyexception

### Repository [GitHub page](https://github.com/frankliuao/easyexception)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easyexception-0.0.3.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easyexception-0.0.3-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file easyexception-0.0.3.tar.gz.

File metadata

  • Download URL: easyexception-0.0.3.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for easyexception-0.0.3.tar.gz
Algorithm Hash digest
SHA256 00018ffc1425f92bb75add2048b6629af8d8dd8e8d2697d46c8e25a3c876651b
MD5 9318201e93a87291095110bf5cb03d10
BLAKE2b-256 344be9c091006003fbae7d8179adef604aea2226b00de4b15701b495f4e493ce

See more details on using hashes here.

File details

Details for the file easyexception-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: easyexception-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for easyexception-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9b0ef887c5f1cca412ca0c873054806e451f96cf02d8f28eba5b1cd191ad1ed8
MD5 22744b6e8142bc3904b1dbd245464027
BLAKE2b-256 accee0f66cd8eaf3c24718f6c22e009b122c39a8b0e0555c7e2387958549910d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page