Skip to content

Commit

Permalink
MAINT: stats.rv_generic: make error message “Domain error in argument…
Browse files Browse the repository at this point in the history
…s” more informative (scipy#13172)

MAINT: stats.rv_generic: make error message “Domain error in arguments” more informative

Co-authored-by: Matt Haberland <[email protected]>
  • Loading branch information
ZhihuiChen0903 and mdhaber authored Feb 21, 2022
1 parent d129585 commit 33f2423
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scipy/stats/_distn_infrastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,10 @@ def rvs(self, *args, **kwds):
args, loc, scale, size = self._parse_args_rvs(*args, **kwds)
cond = logical_and(self._argcheck(*args), (scale >= 0))
if not np.all(cond):
raise ValueError("Domain error in arguments.")
message = ("Domain error in arguments. The `scale` parameter must "
"be positive for all distributions; see the "
"distribution documentation for other restrictions.")
raise ValueError(message)

if np.all(scale == 0):
return loc*ones(size, 'd')
Expand Down

0 comments on commit 33f2423

Please sign in to comment.