From a446a688e562fec083a9347a9e5c680101f36b2a Mon Sep 17 00:00:00 2001 From: "Jason C. Nucciarone" Date: Mon, 26 Aug 2024 10:57:11 -0400 Subject: [PATCH] feat: add `BaseError` and `ModelError` for more granular exceptions Signed-off-by: Jason C. Nucciarone --- slurmutils/exceptions.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/slurmutils/exceptions.py b/slurmutils/exceptions.py index 253c669..18022ee 100644 --- a/slurmutils/exceptions.py +++ b/slurmutils/exceptions.py @@ -15,5 +15,18 @@ """Exceptions raised by Slurm utilities in this package.""" -class EditorError(Exception): +class BaseError(Exception): + """Base exception for errors in `slurmutils` module.""" + + @property + def message(self) -> str: + """Return message passed as argument to exception.""" + return self.args[0] + + +class EditorError(BaseError): """Raise when a Slurm configuration editor encounters an error.""" + + +class ModelError(BaseError): + """Raise when a Slurm configuration model encounters an error."""