hensm/fx_cast

Improve bridge error handling

hensm opened this issue · 0 comments

hensm commented

Error handling for CastClient#connect is possibly incorrect and broken depending on how error events are emitted. Rejected promise is not handled by consumers and causes the bridge to crash which can under certain conditions result in error loops when the bridge is restarted.

connect(host: string, options?: CastClientConnectOptions) {
return new Promise<void>((resolve, reject) => {
// Handle errors
this.client.on("error", reject);