On Wed, Feb 20, 2013 at 1:07 PM, Gustavo Machado <[email protected]> wrote:
> Hi Ben,
>
>>
>> EPIPE means you're writing to a pipe or socket when the other end has
>> terminated the connection.
>>
>> It's a run-time error; there is nothing you can do but close your end as
>> well.
>
>
> Since it's throwing, looks like I have to add some try/catch in order to be
> able to close my end (am I right?). Judging by the stack trace, I won't be
> able to do so. Can you point me to some more information on how to handle
> this exception?
>
> Thanks,
> Gustavo Machado

You catch it by installing an 'error' event listener on the socket
object, like this:

  var conn = net.createConnection(...);
  conn.on('error', function(err) {
    console.log('caught ' + err);
  });

(Ditto for dgram/http/https/etc. objects.)

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to