buildman: Refactor error-line output int a function