Skip to content

Commit

Permalink
Adds import sentry comment
Browse files Browse the repository at this point in the history
  • Loading branch information
language-shprt committed Oct 2, 2023
1 parent 5851fb3 commit 91300ca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/reference/sentry.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 91300ca

Please sign in to comment.