Skip to content
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

overrideImportLocation try/catch #1257

Merged
merged 1 commit into from
Sep 29, 2024

Conversation

simakvladimir
Copy link
Contributor

Hi!

Problem:

The node-soap library allows overriding the import location of WSDL files by defining an overrideImportLocation function in the options object. However, if the code within this function throws an error, the entire application crashes. This is because overrideImportLocation is invoked in the process.nextTick queue, and the createClient callback is not invoked.

Furthermore, in our project, we require complex logic to determine the import location. This necessitates the ability to throw user-defined exceptions within the overrideImportLocation function. It would be highly beneficial if these exceptions were returned by the client callback function.

Proposed solution:

To address these issues, we propose the following:

  1. Wrap overrideImportLocation in a try-catch block: This will ensure that any errors thrown within the function are caught and handled gracefully.

  2. Extend overrideImportLocation arguments: instead of returning only the location (for backward compatibility), it should also return the URI, include path, and options. This extended set of arguments facilitates the implementation of complex logic to determine the sub-WSDL location. The options parameter can be used to redefine specific parameters for the sub-WSDL.

Copy link
Collaborator

@w666 w666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense. Thanks for the test.

@w666 w666 merged commit 96455b7 into vpulim:master Sep 29, 2024
1 check passed
@w666
Copy link
Collaborator

w666 commented Sep 29, 2024

Just released new version 1.1.5

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.

2 participants