Skip to content

Commit 205e83d

Browse files
fix: raise error when _finalized simulation fails
1 parent 51161f9 commit 205e83d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/test_components/test_source_frames.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ def test_source_absorber_frames():
6868
)
6969
],
7070
)
71-
with pytest.raises(pydantic.ValidationError):
72-
_ = bad_sim._finalized
71+
with pytest.raises(td.exceptions.Tidy3dError):
72+
_ = bad_sim._validate_finalized()

tidy3d/components/simulation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,11 +2243,11 @@ def _validate_finalized(self):
22432243

22442244
try:
22452245
_ = self._finalized
2246-
except Exception:
2247-
log.error(
2246+
except Exception as e:
2247+
raise Tidy3dError(
22482248
"Simulation fails after requested mode source PEC frames are added. "
22492249
"Please inspect '._finalized'."
2250-
)
2250+
) from e
22512251

22522252

22532253
class Simulation(AbstractYeeGridSimulation):

0 commit comments

Comments
 (0)