diff --git a/lib/wsdl.js b/lib/wsdl.js index 65abe8dc4..8edf54bf7 100644 --- a/lib/wsdl.js +++ b/lib/wsdl.js @@ -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) { diff --git a/test/wsdl-test.js b/test/wsdl-test.js index a4e949353..61d68db6e 100644 --- a/test/wsdl-test.js +++ b/test/wsdl-test.js @@ -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);