HEX
Server: Apache
System: Linux 162-240-236-42.bluehost.com 3.10.0-1160.114.2.el7.x86_64 #1 SMP Wed Mar 20 15:54:52 UTC 2024 x86_64
User: bt667 (1004)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //usr/libexec/kcare/python/kcarectl/errors.py
# Copyright (c) Cloud Linux Software, Inc
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENCE.TXT

from .py23 import HTTPError


class SafeExceptionWrapper(Exception):
    def __init__(self, inner, etype=None, details=None):
        self.inner = inner
        self.etype = etype
        self.details = details


class KcareError(Exception):
    """Base kernelcare exception which will be considered as expected
    error and the full traceback will not be shown.
    """

    pass


class NotFound(HTTPError):
    pass


class NoLibcareLicenseException(KcareError):
    pass


class CapabilitiesMismatch(KcareError):
    pass


class AlreadyTrialedException(KcareError):
    def __init__(self, ip, created, *args, **kwargs):
        super(AlreadyTrialedException, self).__init__(*args, **kwargs)
        self.created = created[0 : created.index('T')]
        self.ip = ip

    def __str__(self):
        return 'The IP {0} was already used for a trial license on {1}'.format(self.ip, self.created)


class UnableToGetLicenseException(KcareError):
    def __init__(self, code):
        Exception.__init__(self, 'Unknown Issue when getting trial license. Error code: ' + str(code))


class BadSignatureException(KcareError):
    pass


def check_exc(*exc_list):
    def inner(e, state):
        return isinstance(e, exc_list)

    return inner