postgres icon indicating copy to clipboard operation
postgres copied to clipboard

add error handler to subscribe

Open Louis-Tian opened this issue 1 year ago • 4 comments

Related to https://github.com/porsager/postgres/issues/757.

Expose a error handler on the subscribe function so any error happened while streaming replica can be handled in user space.

Louis-Tian avatar Jan 24 '24 00:01 Louis-Tian

Can you update the Typescript definition to include this please?

mattbishop avatar Jan 24 '24 15:01 mattbishop

@mattbishop done. Happy to add a test case for it as well.

But I am not sure what would be best way to go about it. Specifically what's the best way to stub the stream in test to force an error?

Louis-Tian avatar Jan 24 '24 22:01 Louis-Tian

@Louis-Tian I have some other tests where I just terminate the backend. Perhaps that's a way forward?

porsager avatar Feb 17 '24 12:02 porsager

@porsager That's kind of what I am doing in the error handler anyway so that will work for me. Just think it would be better to let the user to decide to what do? But if there is other things that require a direct termination then I guess it make perfect sense to just leverage on that.

Louis-Tian avatar Feb 18 '24 02:02 Louis-Tian

This already seems to be merged, so I don't understand why the PR is still open.

porsager avatar May 15 '24 11:05 porsager