Skip to content

Commit

Permalink
Fix misleading error message for epsilon values
Browse files Browse the repository at this point in the history
In `BaseEM` class, epsilon properties are allowed to be zero or
positive, although the error message stated that epsilon should be
greater than zero. Fix the error message to agree with the implemented
logic and also print the offending value.
  • Loading branch information
santisoler committed Sep 21, 2023
1 parent 2d0cbb6 commit 64d3f8f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion geoana/em/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ def epsilon(self, value):
raise TypeError(f"epsilon must be a number, got {type(value)}")

if value < 0.0:
raise ValueError("epsilon must be greater than 0")
raise ValueError(
f"Invalid epsilon '{value}': "
"epsilon must be greater or equal than than zero."
)

self._epsilon = value

Expand Down

0 comments on commit 64d3f8f

Please sign in to comment.