Skip to content

Commit 3e3d5e8

Browse files
louis.tianporsager
louis.tian
authored andcommitted
add handler
1 parent cd02af8 commit 3e3d5e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/subscribe.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default function Subscribe(postgres, options) {
4747

4848
return subscribe
4949

50-
async function subscribe(event, fn, onsubscribe = noop) {
50+
async function subscribe(event, fn, onsubscribe = noop, onerror = noop) {
5151
event = parseEvent(event)
5252

5353
if (!connection)
@@ -66,6 +66,7 @@ export default function Subscribe(postgres, options) {
6666
return connection.then(x => {
6767
connected(x)
6868
onsubscribe()
69+
stream && stream.on('error', onerror)
6970
return { unsubscribe, state, sql }
7071
})
7172
}

0 commit comments

Comments
 (0)