Skip to content

Commit

Permalink
fix: prevent process exit on parse error
Browse files Browse the repository at this point in the history
  • Loading branch information
trew authored and steabert committed Oct 7, 2020
1 parent 4bcee86 commit ed7bad0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/components/rtsp-parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ export class RtspParser extends Tube {
objectMode: true,
transform: function (msg: Message, encoding, callback) {
if (msg.type === MessageType.RAW) {
parser.parse(msg.data).forEach((message) => incoming.push(message))
callback()
try {
parser.parse(msg.data).forEach((message) => incoming.push(message))
callback()
} catch (e) {
callback(e)
}
} else {
// Not a message we should handle
callback(undefined, msg)
Expand Down

0 comments on commit ed7bad0

Please sign in to comment.