Skip to content
Browse files

Upgrade for node 0.1.30-pre

  • Loading branch information...
1 parent eb15bed commit 4c2709c6ce6f59428e587a13986f52ac8e181828 @ry ry committed Feb 20, 2010
Showing with 14 additions and 16 deletions.
  1. +14 −16 fu.js
View
30 fu.js
@@ -70,22 +70,20 @@ fu.staticHandler = function (filename) {
}
sys.puts("loading " + filename + "...");
- var promise = readFile(filename, encoding);
-
- promise.addCallback(function (data) {
- body = data;
- headers = [ [ "Content-Type" , content_type ]
- , [ "Content-Length" , body.length ]
- ];
- if (!DEBUG)
- headers.push(["Cache-Control", "public"]);
-
- sys.puts("static file " + filename + " loaded");
- callback();
- });
-
- promise.addErrback(function () {
- sys.puts("Error loading " + filename);
+ readFile(filename, encoding, function (err, data) {
+ if (err) {
+ sys.puts("Error loading " + filename);
+ } else {
+ body = data;
+ headers = [ [ "Content-Type" , content_type ]
+ , [ "Content-Length" , body.length ]
+ ];
+ if (!DEBUG)
+ headers.push(["Cache-Control", "public"]);
+
+ sys.puts("static file " + filename + " loaded");
+ callback();
+ }
});
}

0 comments on commit 4c2709c

Please sign in to comment.
Something went wrong with that request. Please try again.