def format_moz_error(query, exception):
    """
    Format syntax error when parsing the original query.

    """
    line = exception.lineno
    column = exception.col
    detailed_message = str(exception)

    msg = query.split('\n')[:line]
    msg.append('{indent}^'.format(indent=' ' * (column - 1)))
    msg.append(detailed_message)
    return '\n'.join(msg)