DailyJS

Node Roundup: 0.11.12, Metalsmith, Promises and Error Handling

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

node modules npm promises generators

Node Roundup: 0.11.12, Metalsmith, Promises and Error Handling

Posted by Alex R. Young on .
Featured

node modules npm promises generators

Node Roundup: 0.11.12, Metalsmith, Promises and Error Handling

Posted by Alex R. Young on .
Job ad: Iridize is looking for a lead frontend developer.

Node 0.11.12

Node 0.11.12 is out. It updates uv, some of Node's C++ code in src/, and several core modules including cluster and net.

One commit that caught my attention was buffer: allow toString to accept Infinity for end by Brian White. He said he sometimes sets INSPECT_MAX_BYTES to Infinity, allowing the buffer's contents to be printed for debugging purposes. I think it's interesting that this works, even though it's not something I'd usually want to do.

Metalsmith

Ian Storm Taylor sent in Metalsmith, a really cool static site generator by Segment.io. Why is it cool? Well, they had me at the entirely plugin-based API that uses chainable calls:

Metalsmith(__dirname)  
  .use(drafts())
  .use(markdown())
  .use(permalinks('posts/:title'))
  .use(templates('handlebars'))
  .build();

Promises and Error Handling

Promises and Error Handling by Jon Merrifield is all about error handling with promises in Node. It has guidelines for using promises safely, including the idea that you should reject rather than throw and how to terminate chains early and safely.

Changing the then in the above code to done means that there will be no outer promise returned from this, and the error will result in an asynchronous uncaught exception, which will bring down the Node process. In theory this makes it unlikely that any such problem would make it into production, given how loudly and clearly it would fail during development and testing.