Skip to content

Conversation

@jaganvarun059
Copy link

@jaganvarun059 jaganvarun059 commented Oct 14, 2024

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.

@jaganvarun059 jaganvarun059 changed the title Fix: Handle Stream Error Fix Stream Error Handling in Strophe v3.0.1 Nov 6, 2024
}
log.error(errorString);
// The stream error is sent to the Strophe error method, allowing it to be handled.
Strophe.error(errorString);
Copy link
Contributor

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.

Copy link
Author

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?

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants