From a55a3159724cf1d93bbef29f95d723b950ed9e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 17 Mar 2024 05:34:31 +0100 Subject: [PATCH] Exceptions --- README.md | 3 ++- index.html | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b9ae928..ccb36b5 100644 --- a/README.md +++ b/README.md @@ -1409,9 +1409,10 @@ except (, [...]): ... except (, [...]) as : ... ``` * **Also catches subclasses of the exception.** -* **Use `'traceback.print_exc()'` to print the error message to stderr.** +* **Use `'traceback.print_exc()'` to print the full error message to stderr.** * **Use `'print()'` to print just the cause of the exception (its arguments).** * **Use `'logging.exception()'` to log the passed message, followed by the full error message of the caught exception.** +* **Use `'sys.exc_info()'` to get exception type, object and traceback of caught exception.** ### Raising Exceptions ```python diff --git a/index.html b/index.html index 8eff0f8..6ef9991 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -1204,9 +1204,10 @@ LogicOp = Enum('LogicOp', {'traceback.print_exc()' to print the error message to stderr. +
  • Use 'traceback.print_exc()' to print the full error message to stderr.
  • Use 'print(<name>)' to print just the cause of the exception (its arguments).
  • Use 'logging.exception(<message>)' to log the passed message, followed by the full error message of the caught exception.
  • +
  • Use 'sys.exc_info()' to get exception type, object and traceback of caught exception.
  • Raising Exceptions

    raise <exception>
     raise <exception>()
    @@ -2934,7 +2935,7 @@ $ deactivate                  # Deactivates the activ