#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exception classes"""

import logging
from .enums import *

class UpdateBaseError(Exception):

    """Internal error if a transaction could not be processed successfully."""

    _dbus_error_name = "org.debian.apt.TransactionFailed"

    def __init__(self, code,desc=None,*args):
        self.code = code
        
        if not desc:
            self.desc = get_error_description_from_enum(self.code)
        else:
            self.desc = desc

        Exception.__init__(self, *args)

    def __str__(self):
        return "%s" % \
            (get_error_description_from_enum(self.code))

class UpdateProgressExit(Exception):
    def __init__(self,*args):
        Exception.__init__(self, *args)
        logging.info("Update Progress wiil be Exit...")

class DebDeltaError(UpdateBaseError):

    """Internal error if a transaction could not be processed successfully."""

# vim:ts=4:sw=4:et
