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

Handle erroneous commands gracefully #48

Closed
akavlie opened this issue Oct 28, 2011 · 5 comments
Closed

Handle erroneous commands gracefully #48

akavlie opened this issue Oct 28, 2011 · 5 comments

Comments

@akavlie
Copy link
Contributor

akavlie commented Oct 28, 2011

Sent this through client.send()

/leave #pocoo

Oops, should have been /part. Rather than gracefully handling the error though, I get this:

/Users/akavlie/node_modules/irc/lib/irc.js:907
                    throw err;
                    ^
Error: Uncaught, unspecified 'error' event.
    at Client.emit (events.js:47:15)
    at Client.<anonymous> (/Users/akavlie/node_modules/irc/lib/irc.js:818:26)
    at Client.emit (events.js:64:17)
    at /Users/akavlie/node_modules/irc/lib/irc.js:904:22
    at Array.forEach (native)
    at Socket.<anonymous> (/Users/akavlie/node_modules/irc/lib/irc.js:901:15)
    at Socket.emit (events.js:64:17)
    at Socket._onReadable (net.js:673:31)
    at IOWatcher.onReadable [as callback] (net.js:177:10)

running on 0.2.1 via npm

@martynsmith
Copy link
Owner

You should just bind a handler to catch errors?

e.g.

client.on('error', function(e) { do something here })

I think that'll stop it exploding

On Fri, Oct 28, 2011 at 7:20 PM, Aaron Kavlie <
[email protected]>wrote:

Sent this through client.send()

/leave #pocoo

Oops, should have been /part. Rather than gracefully handling the error
though, I get this:

/Users/akavlie/node_modules/irc/lib/irc.js:907
throw err;
^
Error: Uncaught, unspecified 'error' event.
at Client.emit (events.js:47:15)
at Client.
(/Users/akavlie/node_modules/irc/lib/irc.js:818:26)
at Client.emit (events.js:64:17)
at /Users/akavlie/node_modules/irc/lib/irc.js:904:22
at Array.forEach (native)
at Socket.
(/Users/akavlie/node_modules/irc/lib/irc.js:901:15)
at Socket.emit (events.js:64:17)
at Socket._onReadable (net.js:673:31)
at IOWatcher.onReadable as callback

running on 0.2.1 via npm

Reply to this email directly or view it on GitHub:
#48

@akavlie
Copy link
Contributor Author

akavlie commented Oct 28, 2011

Ah, as long as that handler is bound it catches all errors? No explicit try/catch needed on my end?

@martynsmith
Copy link
Owner

I think that's correct, let me know if you experience different :-)

On Fri, Oct 28, 2011 at 7:31 PM, Aaron Kavlie <
[email protected]>wrote:

Ah, as long as that handler is bound it catches all errors? No explicit
try/catch needed on my end?

Reply to this email directly or view it on GitHub:
#48 (comment)

@martynsmith
Copy link
Owner

@akavlie - are you okay to close this issue then?

@akavlie
Copy link
Contributor Author

akavlie commented Oct 31, 2011

Sure, haven't tried the handler yet but I'll assume you're right. Thanks!

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

No branches or pull requests

2 participants