Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 becauseoverrideImportLocation
is invoked in theprocess.nextTick
queue, and thecreateClient
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:
Wrap
overrideImportLocation
in a try-catch block: This will ensure that any errors thrown within the function are caught and handled gracefully.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.