Fix Stream Error Handling in Strophe v3.0.1#754
Fix Stream Error Handling in Strophe v3.0.1#754jaganvarun059 wants to merge 3 commits intostrophe:masterfrom
Conversation
| } | ||
| 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.
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.
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.
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.errormethod 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_checkStreamErrormethod immediately after logging the error to the console.Strophe.errormethod override to capture stream error details, allowing custom error handling to function as expected.Testing:
Verified that
Strophe.errorsuccessfully captures and processes stream error details with the custom error handling code.