-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try catch subscription handlers #1019
Conversation
@@ -45,7 +45,7 @@ export interface ObjectSetListener< | |||
/** | |||
* There was a fatal error with the subscription process. The subscription will close or will not be established. | |||
*/ | |||
onError?: (errors: Array<any>) => void; | |||
onError?: (errors: { subscriptionClosed: boolean; error: any }) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Settled on a boolean here, the alternative was an enum to also be able to display the "I already tried to reconnect for you case" but I think that adds unnecessary complexity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I need to make it isSubscriptionClosed?
sub.listener.onChange?.(osdkObject); | ||
} catch (error) { | ||
this.#logger?.error(error, "Error in onChange callback"); | ||
sub.listener.onError({ subscriptionClosed: false, error }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if an error happens while in onError
the whole thing still breaks, no? We need a fallback in that case.
No description provided.