@classmethod
def check_return(cls, done):
    """
        Check DLL-API exit code for errors and raise exception.

        :param int done: exit code of an DLL function
        :raises RuntimeError: if the exit code is a known error code != 0
        :raises ValueError: if the exit code is unknown
        """
    if 0 < done and done < len(cls.error_messages):
        raise RuntimeError(cls.error_messages[done])
    elif done != 0:
        raise ValueError('Unknown error: %i' % done)
