def _create_msg_error(msg, node=None, row=None):
    """create error message, optionally including TexNode and row"""
    text = msg.strip()
    if row is not None:
        text = '(row {}) '.format(row) + text
    if hasattr(node, 'name'):
        text = text + ': {}'.format(node.name)
    return text
