Skip to content

Commit

Permalink
Create invalid snapshot exception
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Oct 6, 2023
1 parent 4e80b7f commit a418000
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions swiftsimio/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,32 @@ def __str__(self):
Print warning message of invalid scale factor
"""
return f"InvalidScaleFactor: {self.message}"


class InvalidSnapshot(Exception):
"""
Generated when a snapshot is invalid (e.g. you are trying to partially load a
sub-snapshot).
"""

def __init__(self, message=None, *args):
"""
Constructor for warning of invalid snapshot
Parameters
----------
message : str, optional
Message to print in case of invalid snapshot
"""
self.message = message

def __str__(self):
"""
Print warning message of invalid snapshot
"""
return f"InvalidSnapshot: {self.message}"



class cosmo_factor:
Expand Down

0 comments on commit a418000

Please sign in to comment.