
from __future__ import absolute_import, unicode_literals


class CommandError(Exception):
    @property
    def errno(self):
        return self.__errno

    def __init__(self, *args, **kwargs):
        self.__errno = kwargs.pop("errno", None)

        super(CommandError, self).__init__(*args, **kwargs)


class InvalidCommandError(CommandError):
    # Deprecate in the future
    pass


class CommandNotFoundError(CommandError):
    # Deprecate in the future
    pass


from __future__ import absolute_import, unicode_literals


class CommandError(Exception):
    @property
    def cmd(self):
        return self.__cmd

    @property
    def errno(self):
        return self.__errno

    def __init__(self, *args, **kwargs):
        self.__cmd = kwargs.pop("cmd", None)
        self.__errno = kwargs.pop("errno", None)

        super(CommandError, self).__init__(*args, **kwargs)


class InvalidCommandError(CommandError):
    # Deprecate in the future
    pass


class CommandNotFoundError(CommandError):
    # Deprecate in the future
    pass

Add a property to an exception class
Add a property to an exception class

  
  from __future__ import absolute_import, unicode_literals
  
  
  class CommandError(Exception):
      @property
+     def cmd(self):
+         return self.__cmd
+ 
+     @property
      def errno(self):
          return self.__errno
  
      def __init__(self, *args, **kwargs):
+         self.__cmd = kwargs.pop("cmd", None)
          self.__errno = kwargs.pop("errno", None)
  
          super(CommandError, self).__init__(*args, **kwargs)
  
  
  class InvalidCommandError(CommandError):
      # Deprecate in the future
      pass
  
  
  class CommandNotFoundError(CommandError):
      # Deprecate in the future
      pass
  
Add a property to an exception class
## Code Before:

from __future__ import absolute_import, unicode_literals


class CommandError(Exception):
    @property
    def errno(self):
        return self.__errno

    def __init__(self, *args, **kwargs):
        self.__errno = kwargs.pop("errno", None)

        super(CommandError, self).__init__(*args, **kwargs)


class InvalidCommandError(CommandError):
    # Deprecate in the future
    pass


class CommandNotFoundError(CommandError):
    # Deprecate in the future
    pass

## Instruction:
Add a property to an exception class
## Code After:

from __future__ import absolute_import, unicode_literals


class CommandError(Exception):
    @property
    def cmd(self):
        return self.__cmd

    @property
    def errno(self):
        return self.__errno

    def __init__(self, *args, **kwargs):
        self.__cmd = kwargs.pop("cmd", None)
        self.__errno = kwargs.pop("errno", None)

        super(CommandError, self).__init__(*args, **kwargs)


class InvalidCommandError(CommandError):
    # Deprecate in the future
    pass


class CommandNotFoundError(CommandError):
    # Deprecate in the future
    pass
