milewise/node-soap — pull request #166 by tkareine (2013-09-08 17:06:15+00:00)
Title: Include response and body in err object

When a remote web service responds with error, the client callback handler should get an error object containing all the information relevant to the error. Even though this information is available in `response` and `body` parameters of the callback, it makes using the library difficult with promise libraries (such as [Q](https://github.com/kriskowal/q)), which expect the error object to contain all the information.

Example usage:

```js
var Q = require('q');
var soap = require('soap');

var serviceUrl = // ...
var methodArgs = // ...

Q.nfcall(soap.createClient, serviceUrl)
.then(function(client) {
return Q.nfapply(client.Method, methodArgs);
})
.then(
function(result) { console.log(result); },
function(err) { // no other parameters than err
console.error(err); // response and body should be available in err for debugging
}
);
```