added generic error writer method with line info