Skip to content

Commit

Permalink
Change ValueError to UserConfigValidationException in casual_mana…
Browse files Browse the repository at this point in the history
…ger.py (#2209)

* Change `ValueError` to `UserConfigValidationException`

The `ValueError` being raised is asking user to update the configuration. So this should be `UserConfigValidationException`.

* Fix failing test and linting

Signed-off-by: Gaurav Gupta <[email protected]>

---------

Signed-off-by: Gaurav Gupta <[email protected]>
  • Loading branch information
gaugup authored Aug 9, 2023
1 parent c451b2f commit 5eced64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion responsibleai/responsibleai/managers/causal_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ def _fit_causal_analysis(
"upper_bound_on_cat_expansion={})."
).format(max_cat_expansion, max_cat_expansion)
if expected in message:
raise ValueError(message + clarification)
raise UserConfigValidationException(
message + clarification)
raise e

def _create_policy(
Expand Down
3 changes: 2 additions & 1 deletion responsibleai/tests/causal/test_causal_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def test_causal_cat_expansion(self, parks_data):
ModelTask.REGRESSION, ['state', 'attraction'])

expected = "Increase the value 50"
with pytest.raises(ValueError, match=expected):
with pytest.raises(
UserConfigValidationException, match=expected):
manager.add(['state'])
manager.compute()

Expand Down

0 comments on commit 5eced64

Please sign in to comment.