Skip to content

Commit

Permalink
Raised error value changed form Attribute to RunTime
Browse files Browse the repository at this point in the history
  • Loading branch information
kzqureshi committed Jan 30, 2024
1 parent 38a823a commit d99176a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions oommfc/drivers/hysteresisdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ def _checkargs(self, **kwargs):
if n - 1 <= 0: # OOMMF counts steps, not points (n -> n-1)
msg = f"Cannot drive with {n=}."
raise ValueError(msg)

def _check_system(self, system):
"""Checks the system has energy in it"""
if len(system.energy) == 0:
raise RuntimeError("System's energy is not defined")

@property
def _x(self):
Expand Down
2 changes: 1 addition & 1 deletion oommfc/drivers/mindriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _checkargs(self, **kwargs):
def _check_system(self, system):
"""Checks the system has energy in it"""
if len(system.energy) == 0:
raise AttributeError("System's energy is not defined")
raise RuntimeError("System's energy is not defined")

@property
def _x(self):
Expand Down
4 changes: 2 additions & 2 deletions oommfc/drivers/timedriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def _checkargs(self, **kwargs):
def _check_system(self, system):
"""Checks the system has dynamics in it"""
if len(system.dynamics) == 0:
raise AttributeError("System's dynamics is not defined")
raise RuntimeError("System's dynamics is not defined")
if len(system.energy) == 0:
raise AttributeError("System's energy is not defined")
raise RuntimeError("System's energy is not defined")

@property
def _x(self):
Expand Down

0 comments on commit d99176a

Please sign in to comment.