Skip to content

Commit e2fd3a8

Browse files
committed
Error handling
1 parent c3b2f4b commit e2fd3a8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/festim/hydrogen_transport_problem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def initialise_exports(self):
452452
if self.mesh.coordinate_system != CoordinateSystem.CARTESIAN:
453453
raise NotImplementedError(
454454
f"Derived quantity exports are not implemented for "
455-
f"{self.mesh.coordinate_system} meshes"
455+
f"{str(self.mesh.coordinate_system)} meshes"
456456
)
457457

458458
# if name of species is given then replace with species object

src/festim/mesh/mesh.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ def from_string(cls, s: str):
2929
"coordinate_system must be one of 'cartesian', 'cylindrical', or 'spherical'"
3030
)
3131

32+
def __str__(self):
33+
if self == CoordinateSystem.CARTESIAN:
34+
return "cartesian"
35+
elif self == CoordinateSystem.CYLINDRICAL:
36+
return "cylindrical"
37+
elif self == CoordinateSystem.SPHERICAL:
38+
return "spherical"
39+
else:
40+
raise ValueError("Invalid CoordinateSystem value")
41+
3242

3343
class Mesh:
3444
"""

0 commit comments

Comments
 (0)