diff --git a/docs/reference/sentry.md b/docs/reference/sentry.md index fe9f7e6cf..13edb467b 100644 --- a/docs/reference/sentry.md +++ b/docs/reference/sentry.md @@ -44,6 +44,17 @@ class MyApplication(asab.Application): self.SentryService = asab.sentry.SentryService(self) ``` +To avoid overshadowing the parent `asab` module in the local scope of the `__init__`, use the following approach when importing the `sentry` module. This way the `sentry` submodule will be recognized as a sepate local entity and won't affect global `asab`: + +```python +class MyApplication(asab.Application): + def __init__(self): + super().__init__() + if "sentry" in asab.Config.sections(): + from asab import sentry + self.SentryService = sentry.SentryService(self) +``` + After the service is initialized: - all uncaught exceptions are sent as events