From ad072ef24a9f909e67388e5f0752bb8f688b345f Mon Sep 17 00:00:00 2001 From: Claas Date: Sat, 9 Nov 2024 13:14:05 +0100 Subject: [PATCH] moved `CaseInitError` and `CaseUseError` into a separate module 'exceptions.py' --- src/sim_explorer/case.py | 13 +------------ src/sim_explorer/exceptions.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 src/sim_explorer/exceptions.py diff --git a/src/sim_explorer/case.py b/src/sim_explorer/case.py index 6682af7..489051f 100644 --- a/src/sim_explorer/case.py +++ b/src/sim_explorer/case.py @@ -13,6 +13,7 @@ import numpy as np from libcosimpy.CosimLogging import CosimLogLevel, log_output_level +from sim_explorer.exceptions import CaseInitError from sim_explorer.json5 import Json5 from sim_explorer.simulator_interface import SimulatorInterface from sim_explorer.utils.misc import from_xml @@ -32,18 +33,6 @@ """ -class CaseInitError(Exception): - """Special error indicating that something is wrong during initialization of cases.""" - - pass - - -class CaseUseError(Exception): - """Special error indicating that something is wrong during usage of cases.""" - - pass - - def _assert(condition: bool, msg: str, crit: int = 4, typ=CaseInitError): """Check condition and raise error is relevant with respect to condition and crit.""" if crit == 1: diff --git a/src/sim_explorer/exceptions.py b/src/sim_explorer/exceptions.py new file mode 100644 index 0000000..2d4709b --- /dev/null +++ b/src/sim_explorer/exceptions.py @@ -0,0 +1,15 @@ +from __future__ import annotations + +"""This module contains custom exceptions for the sim-explorer package.""" + + +class CaseInitError(Exception): + """Special error indicating that something is wrong during initialization of cases.""" + + pass + + +class CaseUseError(Exception): + """Special error indicating that something is wrong during usage of cases.""" + + pass