So this code relies on fact there would be no exception in 'writeFile',
'fs.write' or any other called function. And if I try to change those, I
should keep in mind that sometimes I can throw exceptions and sometimes I
don't, like here:

  if (!Buffer.isBuffer(buffer)) {
    // legacy string interface (fd, data, position, encoding, callback)
    callback = arguments[4];
    position = arguments[2];
    assertEncoding(arguments[3]);

    buffer = new Buffer('' + arguments[1], arguments[3]);
    offset = 0;
    length = buffer.length;
  }

assertEncding throws an error, but you just know that there would be a
buffer if it is called from 'writeAll'... Is that so?




On Thu, Jun 6, 2013 at 2:36 PM, Ben Noordhuis <i...@bnoordhuis.nl> wrote:

> On Thu, Jun 6, 2013 at 11:51 AM, Matthew Larionov <matthew...@gmail.com>
> wrote:
> > I was curious what would happen if this exception is being cought.
> > Wonder what would happen to 'fd' - file descriptor - as far as I know
> there
> > is no such thing as garbage collector for file descriptors or any other
> > resources except memory...
> >
> > Do you really don't see any way for exception to be raised? Just have a
> look
> > at 'writeAll' function - it's recursive. What would happen if stack is
> > exceeded? I don't understand javascript well actually, but I thought the
> > exception would be thrown.
>
> The self-recursion only goes one level deep.  writeAll() calls itself
> from inside fs.write(), which is an asynchronous function that runs on
> a fresh stack.
>
> --
> --
> 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 nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> 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 a topic in the
> Google Groups "nodejs" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nodejs/gILn3SPCyx4/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> nodejs+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
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 nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to