Returns the string message for the given ``error_code``.

        Args:
          cls (JLinkFlashErrors): the ``JLinkFlashErrors`` class
          error_code (int): error code to convert

        Returns:
          An error string corresponding to the error code.

        Raises:
          ValueError: if the error code is invalid.

def to_string(cls, error_code):
        """Returns the string message for the given ``error_code``.

        Args:
          cls (JLinkFlashErrors): the ``JLinkFlashErrors`` class
          error_code (int): error code to convert

        Returns:
          An error string corresponding to the error code.

        Raises:
          ValueError: if the error code is invalid.
        """
        if error_code == cls.COMPARE_ERROR:
            return 'Error comparing flash content to programming data.'
        elif error_code == cls.PROGRAM_ERASE_ERROR:
            return 'Error during program/erase phase.'
        elif error_code == cls.VERIFICATION_ERROR:
            return 'Error verifying programmed data.'
        return super(JLinkFlashErrors, cls).to_string(error_code)