-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Handling for other return codes #62
Conversation
returnCode: 4 | ||
}, client.close.bind(client, done)) | ||
break | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about a check on err.returnCode if it's between 1 and 4, and use 4 instead? We can avoid the switch.
Can you please add unit tests and docs? |
Cool. I'll make the changes :) |
Will there be test cases for each return code , or a generic one ? Also do I have to add documentation in the Readme ? |
I think you should have test cases for each return code, yes. You can set them up via a for loop. Yes, documentation goes in the README. Thanks! |
returnCode: 4 | ||
}, client.close.bind(client, done)) | ||
return | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can probably avoid the first if.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was for checking if somebody doesn't send the returnCode property. I can merge it with the if below though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's what I meant :)
instance.authenticate = function (client, username, password, callback) { | ||
callback({ returnCode: 1 }, null) | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please attach the returnCode to an Error object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean something like this ?
var error = new Error("Auth error)
error.returnCode = 1
cb(error , null)
That's perfect, thanks very much! |
This has the extra error codes Aedes doesn't return