#!/usr/bin/env python
"""Errors and exceptions"""
from __future__ import annotations
import warnings
from astropy.utils.exceptions import AstropyWarning
from spectral_cube.utils import SpectralCubeWarning
warnings.filterwarnings(action="ignore", category=SpectralCubeWarning, append=True)
warnings.simplefilter("ignore", category=AstropyWarning)
[docs]
class Error(OSError):
pass
[docs]
class SameFileError(Error):
"""Raised when source and destination are the same file."""
[docs]
class SpecialFileError(OSError):
"""Raised when trying to do a kind of operation (e.g. copying) which is
not supported on a special file (e.g. a named pipe)"""
[docs]
class ExecError(OSError):
"""Raised when a command could not be executed"""
[docs]
class ReadError(OSError):
"""Raised when an archive cannot be read"""
[docs]
class RegistryError(Exception):
"""Raised when a registry operation with the archiving
and unpacking registries fails"""
[docs]
class DivergenceError(Exception):
"""Raised when a divergence is detected"""
[docs]
class FitsError(Exception):
"""Raised when a FITS file cannot be read"""