
class ErrorCodes:
    UserCanceledError = 1
    DeviceBusyError = 2

class WriteRequestFailedError(Exception):
    def __init__(self, code, message):
        super().__init__(message)
        self.code = code
        self.message = message


class WriteRequestFailedError(Exception):
    pass

class UserCancelledError(WriteRequestFailedError):
    pass

class PermissionDeniedError(WriteRequestFailedError):
    pass

class DeviceBusyError(WriteRequestFailedError):
    pass

Replace error codes with error subclasses
Replace error codes with error subclasses

This provides the same information but is a cleaner solution for python

- 
- class ErrorCodes:
-     UserCanceledError = 1
-     DeviceBusyError = 2
  
  class WriteRequestFailedError(Exception):
+     pass
-     def __init__(self, code, message):
-         super().__init__(message)
-         self.code = code
-         self.message = message
  
+ class UserCancelledError(WriteRequestFailedError):
+     pass
+ 
+ class PermissionDeniedError(WriteRequestFailedError):
+     pass
+ 
+ class DeviceBusyError(WriteRequestFailedError):
+     pass
+ 
Replace error codes with error subclasses
## Code Before:

class ErrorCodes:
    UserCanceledError = 1
    DeviceBusyError = 2

class WriteRequestFailedError(Exception):
    def __init__(self, code, message):
        super().__init__(message)
        self.code = code
        self.message = message

## Instruction:
Replace error codes with error subclasses
## Code After:

class WriteRequestFailedError(Exception):
    pass

class UserCancelledError(WriteRequestFailedError):
    pass

class PermissionDeniedError(WriteRequestFailedError):
    pass

class DeviceBusyError(WriteRequestFailedError):
    pass
