strophe / strophejs

Strophe.js is an XMPP library for JavaScript
http://strophe.im/strophejs
MIT License
1.46k stars 365 forks source link

Fix Stream Error Handling in Strophe v3.0.1 #754

Open jaganvarun059 opened 1 month ago

jaganvarun059 commented 1 month ago

Issue Summary:

  1. In Strophe.js version 3.0.1, the Strophe.error method is unable to retrieve and process the stream error details.

  2. Currently, error details are only logged to the console instead of being handled.

  3. Previously, custom error handling could be implemented as follows:

Strophe.error = (errorMsg: string) => {
    // Custom error handling code
};

Fix Details:

  1. A call to Strophe.error(errorString) has been added in the _checkStreamError method immediately after logging the error to the console.
  2. This change enables the 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.