Skip to content

Commit a9d16b3

Browse files
committed
Move watch callback out of try-catch
1 parent eaf1b23 commit a9d16b3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/watch.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,16 @@ export class Watch {
121121
stream.on('error', doneCallOnce);
122122
stream.on('close', () => doneCallOnce(null));
123123
stream.on('data', (line) => {
124+
let data;
125+
124126
try {
125-
const data = JSON.parse(line);
126-
callback(data.type, data.object, data);
127+
data = JSON.parse(line);
127128
} catch (ignore) {
128129
// ignore parse errors
130+
return;
129131
}
132+
133+
callback(data.type, data.object, data);
130134
});
131135

132136
req.pipe(stream);

0 commit comments

Comments
 (0)