If the cb() in the try {} throws it will be called again in the catch {} ?

-- 
Jorge.

On Apr 28, 2012, at 2:23 PM, Dominic Tarr wrote:

> oops,
> 
> s/file/fileName
> 
> ... that is the easy to find bug, but there is another one lurking...
> 
> On Sun, Apr 29, 2012 at 12:01 AM, Oliver Leics <oliver.le...@gmail.com> wrote:
>> On Sat, Apr 28, 2012 at 1:58 PM, Dominic Tarr <dominic.t...@gmail.com> wrote:
>>> example, what is wrong with this code:
>>> 
>>> function parseJson (file, cb) {
>>>  fs.readFile(fileName, function (err, data) {
>>>    if(err) return cb(err);
>>>    try { cb(null, JSON.parse(data)); }
>>>    catch (err) { cb(err); }
>>>  });
>>> }
>>> 
>>> ?
>> 
>> Throws, as fileName will be undefined :-P
>> 
>> --
>> 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
> 
> -- 
> 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

-- 
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

Reply via email to