Closed ojingo closed 8 years ago
Ok Ill use this space - in Section 4 of the Kindle Edition
Writing Simple Applications
Listing 4.2 - Handling Multiple Request Types:
I found this and was not sure:
function send_failure(res, code, err) {
var code = (err.code) ? err.code : err.name;
res.writeHead(code, { "Content-Type" : "application/json" });
res.end(JSON.stringify({ error: code, message: err.message }) + "\n");
}
code is used as a parameter and the var code is initialized inside the function... is that ok? seems like it would write over the incoming data for code in parameter?
Hmm … that definitely doesn't look good! Let me look.
Yes, it looks as though the code parameter should not be there — halfway through writing the book, i changed style to start using the err.code idea instead.
I'll put out an errata for that.
Thanks!
This is fixed, but not in the book. I'll be sure to update this.
Hi Marc!
Im reading your book..and already I like it more than all the other ones because of the way you dive into the async and show the common patterns right up front with great explaining.
I was wondering tho - is there an official forum site for the book? or are you just using this repo as the forum for the book?
cheers
TJ