-
Notifications
You must be signed in to change notification settings - Fork 365
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
Fix Stream Error Handling in Strophe v3.0.1 #754
base: master
Are you sure you want to change the base?
Conversation
@@ -121,6 +121,8 @@ class Websocket { | |||
errorString += ' - ' + text; | |||
} | |||
log.error(errorString); | |||
// The stream error is sent to the Strophe error method, allowing it to be handled. | |||
Strophe.error(errorString); |
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.
Thanks for the PR. I understand the problem that you have, but this is not a proper fix.
The Strophe
object isn't imported into this file (and shouldn't be to avoid circular dependencies) and you're relying on Strophe
being a global here, which is not a guarantee.
For a proper fix, we'll need calls to log.error
to somehow be surfaced towards the Strophe
object so that they can be overridden or intercepted via Strophe.error
.
I'm not sure right now what the right solution will be. Maybe the right solution is to just throw and event inside log.error
(and log.info
etc.) which is caught by the Strophe object.
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.
Hi @jcbrand ,
Thanks for the update.
Could you please share the fix for this issue or provide details on how to resolve it?
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.
As I mentioned above:
I'm not sure right now what the right solution will be.
Issue Summary:
In Strophe.js version 3.0.1, the
Strophe.error
method is unable to retrieve and process the stream error details.Currently, error details are only logged to the console instead of being handled.
Previously, custom error handling could be implemented as follows:
Fix Details:
Strophe.error(errorString)
has been added in the_checkStreamError
method immediately after logging the error to the console.Strophe.error
method override to capture stream error details, allowing custom error handling to function as expected.Testing:
Verified that
Strophe.error
successfully captures and processes stream error details with the custom error handling code.