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

WSDL: pass error from parsing XML as-is, not only its message #1022

Merged
merged 1 commit into from Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/wsdl.js
Expand Up @@ -1047,7 +1047,7 @@ var WSDL = function(definition, uri, options) {
try {
fromFunc.call(self, definition);
} catch (e) {
return self.callback(e.message);
return self.callback(e);
}

self.processIncludes(function(err) {
Expand Down
14 changes: 14 additions & 0 deletions test/wsdl-test.js
Expand Up @@ -51,6 +51,20 @@ wsdlStrictTests['should catch parse error'] = function(done) {
});
};

wsdlNonStrictTests['should not give error as string'] = function(done) {
soap.createClient(__dirname+'/wsdl/bad.txt', function(err) {
assert.notEqual(typeof err, 'string');
done();
});
};

wsdlStrictTests['should not give error as string'] = function(done) {
soap.createClient(__dirname+'/wsdl/bad.txt', function(err) {
assert.notEqual(typeof err, 'string');
done();
});
};

wsdlStrictTests['should parse external wsdl'] = function(done) {
soap.createClient(__dirname+'/wsdl/wsdlImport/main.wsdl', {strict: true}, function(err, client){
assert.ifError(err);
Expand Down