

class PollTimeout(Exception):
    pass


class InvalidCredentialsError(Exception):
    pass


class ResponseError(Exception):
    pass


class DoesNotExistError(Exception):
    pass


class AlreadyExistsError(Exception):
    pass


class InvalidKeywordArgumentError(Exception):
    pass


class SWFError(Exception):
    def __init__(self, message, raw_error, *args):
        Exception.__init__(self, message, *args)
        self.kind, self.details = raw_error.split(':')

    def __repr__(self):
        msg = self.message

        if self.kind and self.details:
            msg += '\nReason: {}, {}'.format(self.kind, self.details)

        return msg

    def __str__(self):
        msg = self.message

        if self.kind and self.details:
            msg += '\nReason: {}, {}'.format(self.kind, self.details)

        return msg


class PollTimeout(SWFError):
    pass


class InvalidCredentialsError(SWFError):
    pass


class ResponseError(SWFError):
    pass


class DoesNotExistError(SWFError):
    pass


class AlreadyExistsError(SWFError):
    pass


class InvalidKeywordArgumentError(SWFError):
    pass

Enhance swf errors wrapping via an exception helper
Enhance swf errors wrapping via an exception helper

+ 
+ class SWFError(Exception):
+     def __init__(self, message, raw_error, *args):
+         Exception.__init__(self, message, *args)
+         self.kind, self.details = raw_error.split(':')
+ 
+     def __repr__(self):
+         msg = self.message
+ 
+         if self.kind and self.details:
+             msg += '\nReason: {}, {}'.format(self.kind, self.details)
+ 
+         return msg
+ 
+     def __str__(self):
+         msg = self.message
+ 
+         if self.kind and self.details:
+             msg += '\nReason: {}, {}'.format(self.kind, self.details)
+ 
+         return msg
  
  
- class PollTimeout(Exception):
+ class PollTimeout(SWFError):
      pass
  
  
- class InvalidCredentialsError(Exception):
+ class InvalidCredentialsError(SWFError):
      pass
  
  
- class ResponseError(Exception):
+ class ResponseError(SWFError):
      pass
  
  
- class DoesNotExistError(Exception):
+ class DoesNotExistError(SWFError):
      pass
  
  
- class AlreadyExistsError(Exception):
+ class AlreadyExistsError(SWFError):
      pass
  
  
- class InvalidKeywordArgumentError(Exception):
+ class InvalidKeywordArgumentError(SWFError):
      pass
  
Enhance swf errors wrapping via an exception helper
## Code Before:


class PollTimeout(Exception):
    pass


class InvalidCredentialsError(Exception):
    pass


class ResponseError(Exception):
    pass


class DoesNotExistError(Exception):
    pass


class AlreadyExistsError(Exception):
    pass


class InvalidKeywordArgumentError(Exception):
    pass

## Instruction:
Enhance swf errors wrapping via an exception helper
## Code After:

class SWFError(Exception):
    def __init__(self, message, raw_error, *args):
        Exception.__init__(self, message, *args)
        self.kind, self.details = raw_error.split(':')

    def __repr__(self):
        msg = self.message

        if self.kind and self.details:
            msg += '\nReason: {}, {}'.format(self.kind, self.details)

        return msg

    def __str__(self):
        msg = self.message

        if self.kind and self.details:
            msg += '\nReason: {}, {}'.format(self.kind, self.details)

        return msg


class PollTimeout(SWFError):
    pass


class InvalidCredentialsError(SWFError):
    pass


class ResponseError(SWFError):
    pass


class DoesNotExistError(SWFError):
    pass


class AlreadyExistsError(SWFError):
    pass


class InvalidKeywordArgumentError(SWFError):
    pass
