Skip to content

Commit 7595305

Browse files
committed
✨ Add nice_errors sentry environment config option
1 parent 05fcbb1 commit 7595305

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/extensions/nice_errors/patch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
async def patch(config: dict[str, Any]) -> None:
1414
sentry_sdk = None
15-
if config.get("sentry", {}).get("dsn"):
15+
if (sentry_config := config.get("sentry", {})).get("dsn"):
1616
import sentry_sdk # noqa: PLC0415
1717
from sentry_sdk.integrations.asyncio import AsyncioIntegration # noqa: PLC0415
1818
from sentry_sdk.integrations.logging import LoggingIntegration # noqa: PLC0415
@@ -23,7 +23,8 @@ async def patch(config: dict[str, Any]) -> None:
2323
)
2424

2525
sentry_sdk.init(
26-
dsn=config["sentry"]["dsn"],
26+
dsn=sentry_config["dsn"],
27+
environment=sentry_config.get("environment", "production"),
2728
integrations=[
2829
AsyncioIntegration(),
2930
LoggingIntegration(),

0 commit comments

Comments
 (0)