Skip to content

Commit

Permalink
ref: Update error verbose for sentry init (#1361)
Browse files Browse the repository at this point in the history
  • Loading branch information
targhs authored Apr 26, 2022
1 parent 4cce4b5 commit 6a805fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sentry_sdk/client.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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)

0 comments on commit 6a805fa

Please sign in to comment.