def parse_errors(path):
    """Parse the file path for errors."""
    dct = {'errors': [], 'warnings': [], 'fatal': []}
    fl = path.read_text().split('\n')
    append = False
    temp = ''
    for l in fl:
        if l.startswith('! '):
            dct['fatal'] += [l]
        if l.startswith('./.workspace/test.tex:'):
            temp = l
            append = True
        if append:
            temp += l
        if l.startswith('l.'):
            temp += l
            append = False
            dct['errors'] += [temp]
    for key in ['errors', 'warnings', 'fatal']:
        if dct[key]:
            return dct
    return {}
