Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update error verbose for sentry init #1361

Merged
merged 11 commits into from Apr 26, 2022
3 changes: 3 additions & 0 deletions sentry_sdk/client.py
Expand Up @@ -48,6 +48,9 @@ def _get_options(*args, **kwargs):
else:
dsn = None

if len(args) > 1:
raise TypeError("Only single positional argument is expected")

rv = dict(DEFAULT_OPTIONS)
options = dict(*args, **kwargs)
if dsn is not None and options.get("dsn") is None:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_client.py
Expand Up @@ -887,3 +887,9 @@ def test_max_breadcrumbs_option(
capture_message("dogs are great")

assert len(events[0]["breadcrumbs"]["values"]) == expected_breadcrumbs


def test_multiple_positional_args(sentry_init):
with pytest.raises(TypeError) as exinfo:
sentry_init(1, None)
assert "Only single positional argument is expected" in str(exinfo.value)