Skip to content

Commit e3a8f72

Browse files
committed
capturing -> capture_exceptions
1 parent e669181 commit e3a8f72

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

posthog/scopes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def _get_current_context() -> Dict[str, Any]:
1212

1313

1414
@contextmanager
15-
def new_context(fresh=False, capturing=True):
15+
def new_context(fresh=False, capture_exceptions=True):
1616
"""
1717
Create a new context scope that will be active for the duration of the with block.
1818
Any tags set within this scope will be isolated to this context. Any exceptions raised
@@ -22,7 +22,7 @@ def new_context(fresh=False, capturing=True):
2222
fresh: Whether to start with a fresh context (default: False).
2323
If False, inherits tags from parent context.
2424
If True, starts with no tags.
25-
capturing: Whether to capture exceptions raised within the context (default: True).
25+
capture_exceptions: Whether to capture exceptions raised within the context (default: True).
2626
If True, captures exceptions and tags them with the context tags before propagating them.
2727
If False, exceptions will propagate without being tagged or captured.
2828
@@ -52,7 +52,7 @@ def new_context(fresh=False, capturing=True):
5252
try:
5353
yield
5454
except Exception as e:
55-
if capturing:
55+
if capture_exceptions:
5656
capture_exception(e)
5757
raise
5858
finally:
@@ -92,14 +92,14 @@ def clear_tags() -> None:
9292
F = TypeVar("F", bound=Callable[..., Any])
9393

9494

95-
def scoped(fresh=False, capturing=True):
95+
def scoped(fresh=False, capture_exceptions=True):
9696
"""
9797
Decorator that creates a new context for the function. Simply wraps
9898
the function in a with posthog.new_context(): block.
9999
100100
Args:
101101
fresh: Whether to start with a fresh context (default: False)
102-
capturing: Whether to capture and track exceptions with posthog error tracking (default: True)
102+
capture_exceptions: Whether to capture and track exceptions with posthog error tracking (default: True)
103103
104104
Example:
105105
@posthog.scoped()
@@ -119,7 +119,7 @@ def decorator(func: F) -> F:
119119

120120
@wraps(func)
121121
def wrapper(*args, **kwargs):
122-
with new_context(fresh=fresh, capturing=capturing):
122+
with new_context(fresh=fresh, capture_exceptions=capture_exceptions):
123123
return func(*args, **kwargs)
124124

125125
return cast(F, wrapper)

0 commit comments

Comments
 (0)