Skip to content

Commit 2f8d4df

Browse files
authored
Merge pull request #391 from cmu-delphi/add-exceptions
Add specific exceptions to bare excepts
2 parents 0a7865e + 60b4a79 commit 2f8d4df

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

changehc/delphi_changehc/weekday.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# third party
88
import cvxpy as cp
99
import numpy as np
10+
from cvxpy.error import SolverError
1011

1112
# first party
1213
from .config import Config
@@ -83,7 +84,7 @@ def get_params(data):
8384
try:
8485
prob = cp.Problem(cp.Minimize(-ll + lmbda * penalty))
8586
_ = prob.solve()
86-
except:
87+
except SolverError:
8788
# If the magnitude of the objective function is too large, an error is
8889
# thrown; Rescale the objective function
8990
prob = cp.Problem(cp.Minimize((-ll + lmbda * penalty) / 1e5))

claims_hosp/delphi_claims_hosp/weekday.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# third party
88
import cvxpy as cp
99
import numpy as np
10+
from cvxpy.error import SolverError
1011

1112
# first party
1213
from .config import Config
@@ -83,7 +84,7 @@ def get_params(data):
8384
try:
8485
prob = cp.Problem(cp.Minimize(-ll + lmbda * penalty))
8586
_ = prob.solve()
86-
except:
87+
except SolverError:
8788
# If the magnitude of the objective function is too large, an error is
8889
# thrown; Rescale the objective function
8990
prob = cp.Problem(cp.Minimize((-ll + lmbda * penalty) / 1e5))

emr_hosp/delphi_emr_hosp/weekday.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# third party
88
import cvxpy as cp
99
import numpy as np
10+
from cvxpy.error import SolverError
1011

1112
# first party
1213
from .config import Config
@@ -83,7 +84,7 @@ def get_params(data):
8384
try:
8485
prob = cp.Problem(cp.Minimize(-ll + lmbda * penalty))
8586
_ = prob.solve()
86-
except:
87+
except SolverError:
8788
# If the magnitude of the objective function is too large, an error is
8889
# thrown; Rescale the objective function
8990
prob = cp.Problem(cp.Minimize((-ll + lmbda * penalty) / 1e5))

0 commit comments

Comments
 (0)