Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
exceptions.py48 linesDownload Raw Back to gssapi
1import typing as t2 3from gssapi.raw.exceptions import *  # noqa4from gssapi.raw.misc import GSSError  # noqa5 6"""High-Level API Errors7 8This module includes several high-level exceptions,9in addition to GSSError and exceptions from10:mod:`gssapi.raw.exceptions`.11"""12 13 14# non-GSS exceptions15class GeneralError(Exception):16    """A General High-Level API Error"""17    MAJOR_MESSAGE = "General error"18    FMT_STR = "{maj}: {min}."19 20    def __init__(21        self,22        minor_message: str,23        **kwargs: str,24    ) -> None:25        maj_str = self.MAJOR_MESSAGE.format(**kwargs)26        err_str = self.FMT_STR.format(maj=maj_str, min=minor_message)27        super(GeneralError, self).__init__(err_str)28 29 30class UnknownUsageError(GeneralError):31    """An Error indicating an unknown usage type"""32    MAJOR_MESSAGE = "Unable to determine {obj} usage"33 34 35class EncryptionNotUsed(GeneralError):36    """An Error indicating that encryption was requested, but not used"""37    MAJOR_MESSAGE = "Confidentiality was requested, but not used"38 39    def __init__(40        self,41        minor_message: str,42        unwrapped_message: t.Optional[bytes] = None,43        **kwargs: str,44    ) -> None:45        super(EncryptionNotUsed, self).__init__(minor_message, **kwargs)46 47        self.unwrapped_message = unwrapped_message48 
codekingpro/portable-devtools · Team Ai