io: print line before rethrowing error

This commit is contained in:
Alex Gleason 2023-03-28 21:57:59 -05:00
parent c087e8fddd
commit 225dec7627
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

View File

@ -8,7 +8,12 @@ import type { InputMessage, OutputMessage } from './types.ts';
*/ */
async function* readStdin(): AsyncGenerator<InputMessage> { async function* readStdin(): AsyncGenerator<InputMessage> {
for await (const line of readLines(Deno.stdin)) { for await (const line of readLines(Deno.stdin)) {
yield JSON.parse(line); try {
yield JSON.parse(line);
} catch (e) {
console.error(line);
throw e;
}
} }
} }