Skip to content

Commit 7a570a6

Browse files
authored
Fix exception cause in fista.py (#156)
1 parent 512464f commit 7a570a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

skglm/solvers/fista.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ def solve(self, X, y, datafit, penalty, w_init=None, Xw_init=None):
5151
datafit.init_global_lipschitz_sparse(X.data, X.indptr, X.indices, y)
5252
else:
5353
datafit.init_global_lipschitz(X, y)
54-
except AttributeError:
54+
except AttributeError as e:
5555
sparse_suffix = '_sparse' if X_is_sparse else ''
5656

5757
raise Exception(
5858
"Datafit is not compatible with FISTA solver.\n Datafit must "
59-
f"implement `init_global_lipschitz{sparse_suffix}` method")
59+
f"implement `init_global_lipschitz{sparse_suffix}` method") from e
6060

6161
lipschitz = datafit.global_lipschitz
6262
for n_iter in range(self.max_iter):

0 commit comments

Comments
 (0)