News for hackers. Stuff that matters.
Re:NodeUp 15 - Bears, Wolves, and Poppins by ilaksh on Monday March 19, 2012 @06:56PM (#3726778)
I'm sure this Mikeal guy is a genius and everything, but is it really necessary for him to interrupt and contradict the other guy (was that Isaac?) every 3 seconds?

Anyway this Domains idea, is it something like:

    var domain = require('domain');
    var http = require('http');
    var fs = require('fs');

    domain.handleError('fsdb', data, function(err) {
      console.log('There was an error updating thing #' + data);
    });

    updateThing = function(id, data, callback) {
      domain.run('fsdb', id, function() {
        var options = { host: 'things.myserver.io', port: 80, 
                        path: '/update?id='+id+'&v='+data.new};
        http.get(options, function(res) {
          fs.writeFile(data.fname, data.file, function() {
            callback();
          });          
        });
      });
    }
So something in fs and http makes it call domain.handleError with the details if there is a problem with the request or file write?

Forgive me if I am completely misunderstanding or if this is a bad example.

There are no comments on this comment yet.