error handling for read_lines