summaryrefslogtreecommitdiff
path: root/src/click/globals.py
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2021-09-26 07:04:19 -0700
committerDavid Lord <davidism@gmail.com>2021-09-26 07:04:19 -0700
commit905b1bfd6e90f0fd6a2d4f0afa08f8ddebc4f488 (patch)
treec627de22ba3e770bd210e0a23f4ce7ef45fb1d47 /src/click/globals.py
parent737cf793f5e5625c36e3627250beee34ee285f9d (diff)
downloadclick-905b1bfd6e90f0fd6a2d4f0afa08f8ddebc4f488.tar.gz
use exception chaining
fixes flake8-bugbear B904
Diffstat (limited to 'src/click/globals.py')
-rw-r--r--src/click/globals.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/click/globals.py b/src/click/globals.py
index cfcade1..a7b0c93 100644
--- a/src/click/globals.py
+++ b/src/click/globals.py
@@ -36,9 +36,9 @@ def get_current_context(silent: bool = False) -> t.Optional["Context"]:
"""
try:
return t.cast("Context", _local.stack[-1])
- except (AttributeError, IndexError):
+ except (AttributeError, IndexError) as e:
if not silent:
- raise RuntimeError("There is no active click context.")
+ raise RuntimeError("There is no active click context.") from e
return None