import re


def parse_error(msg, line_offset):
    """
    Return the first error line number and error message.
    """
    # lines = eval(msg).split('\n')
    lines = msg.split('\n')
    for line in lines:
        m = re.match(':(\d+):[:0-9 ]+error: (.*)', line)
        if not m:
            continue
        lineno, message = m.groups()
        return int(lineno) - line_offset, message.strip()
    return None, None