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

Some fixes using with callbacks #11

Closed
wants to merge 9 commits into from
Closed

Conversation

brugnara
Copy link

  • Catched error if trying to open a non existent modem that causes exception trying to close a non opened port.
  • calling callback(error) on errors.
  • null pointer exception

Calling `.close()` on a closed port, trow an exception. This happens when you try to open a non existent port. This patch fixes.
Call callback if exists and on error!
fix null pointer exception.
@@ -102,12 +102,15 @@ var createModem = function() {

modem.port.on('error', function() {
modem.close();
callback && callback(new Error('Serial port error'));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brugnara Sure, I will merge the pull request, just, please change the Error to string and I'll just merge it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emilsedgh done. I think we should talk a bit and do a branch where we can do a huge refactor fixing what we said tomorrow. 👍

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brugnara My email address is emilsedgh@kde.org
You can also find me on IRC, I'm emilsedgh on Freenode and I usually hang out on #Node.js

returning string instead of error
changed returning error string
@brugnara brugnara closed this Sep 18, 2014
@brugnara
Copy link
Author

I've closed this issue because of the number of fixes that this module needs. It is very unstable and it is not usable on production on current state. I've rewritten a new one, called node-modem that fully works with callbacks, handling errors and timeouts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants