Skip to content

Commit

Permalink
moved CaseInitError and CaseUseError into a separate module 'exce…
Browse files Browse the repository at this point in the history
…ptions.py'
  • Loading branch information
ClaasRostock committed Nov 9, 2024
1 parent 80e7654 commit ad072ef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
13 changes: 1 addition & 12 deletions src/sim_explorer/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
15 changes: 15 additions & 0 deletions src/sim_explorer/exceptions.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ad072ef

Please sign in to comment.