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

allow a multi param response #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions lib/deserializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@ Deserializer.prototype.deserializeMethodResponse = function(stream, callback) {
if (error) {
callback(error)
}
else if (result.length > 1) {
callback(new Error('Response has more than one param'))
}
else if (that.type !== 'methodresponse') {
callback(new Error('Not a method response'))
}
else if (!that.responseType) {
callback(new Error('Invalid method response'))
}
else {
callback(null, result[0])
callback(null, result.length === 1 ? result[0] : result)
}
}

Expand Down Expand Up @@ -96,13 +93,13 @@ Deserializer.prototype.onDone = function() {

// TODO:
// Error handling needs a little thinking. There are two different kinds of
// errors:
// errors:
// 1. Low level errors like network, stream or xml errors. These don't
// require special treatment. They only need to be forwarded. The IO
// is already stopped in these cases.
// is already stopped in these cases.
// 2. Protocol errors: Invalid tags, invalid values &c. These happen in
// our code and we should tear down the IO and stop parsing.
// Currently all errors end here. Guess I'll split it up.
// Currently all errors end here. Guess I'll split it up.
Deserializer.prototype.onError = function(msg) {
if (!this.error) {
if (typeof msg === 'string') {
Expand Down