Source code for gunz_cm.exceptions

# -*- coding: utf-8 -*-
"""
Custom exception classes for the gunz_cm package.


Examples
--------
"""
__author__ = "Yeremia Gunawan Adhisantoso"
__email__ = "adhisant@tnt.uni-hannover.de"
__license__ = "Clear BSD"
__version__ = "1.0.0"

[docs] class GunzCMError(Exception): """ Base class for all custom exceptions in the gunz_cm package. Examples -------- """ pass
[docs] class LoaderError(GunzCMError): """ Base class for exceptions in the loaders module. Examples -------- """ pass
[docs] class DatasetError(GunzCMError): """ Base class for exceptions in the datasets module. Examples -------- """ pass
[docs] class FormatError(LoaderError): """ Exception raised for format-related errors. Examples -------- """ pass
[docs] class DataResolutionError(LoaderError): """ Exception raised when there's an issue with data resolution. Examples -------- """ pass
[docs] class PreprocError(GunzCMError): """ Base class for exceptions in the preprocs module. Examples -------- """ pass
[docs] class IOError(GunzCMError): """ Base class for exceptions related to input/output operations. Examples -------- """ pass
[docs] class ConverterError(GunzCMError): """ Base class for exceptions in the converters module. Examples -------- """ pass
[docs] class InvalidRegionFormatError(LoaderError): """ Exception raised for errors in the input region format. Parameters ---------- region : str The invalid region string that caused the error. message : str, optional A custom error message (default is "Invalid region format"). Examples -------- """ def __init__( self, region: str, message: str = "Invalid region format", ) -> None: """ Function __init__. Parameters ---------- Returns ------- Examples -------- Notes ----- """ self.region = region self.message = f"{message}: '{region}'" super().__init__(self.message)
[docs] class UnsupportedLoaderFeatureError(LoaderError): """ Exception raised when a loader does not support a requested feature. Parameters ---------- feature : str The name of the unsupported feature. loader_name : str The name of the loader that does not support the feature. Examples -------- """ def __init__( self, feature: str, loader_name: str, ) -> None: """ Function __init__. Parameters ---------- Returns ------- Examples -------- Notes ----- """ self.feature = feature self.loader_name = loader_name self.message = f"Feature '{feature}' is not supported by the {loader_name}." super().__init__(self.message)
[docs] class ConversionFailedError(ConverterError): """ Exception raised when a conversion process fails. Parameters ---------- region : str The region string for which the conversion failed. message : str, optional A custom error message (default is "Conversion failed"). Examples -------- """ def __init__( self, region: str, message: str = "Conversion failed", ) -> None: """ Function __init__. Parameters ---------- Returns ------- Examples -------- Notes ----- """ self.region = region self.message = f"{message} for region '{region}'" super().__init__(self.message)
[docs] class ReconstructionError(GunzCMError): """ Base class for exceptions in the reconstructions module. Examples -------- """ pass
[docs] class MetricError(GunzCMError): """ Base class for exceptions in the metrics module. Examples -------- """ pass