Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

small fixes

  • Loading branch information...
commit f6db9ceb6a2b6eb696bb2fe4b9dba1c952afdef0 1 parent 35abc7b
@dfilatov authored
View
6 lib/block/http.js
@@ -23,7 +23,7 @@ module.exports = function(defer, params) {
},
function(res) {
if(res.statusCode == 404) {
- defer.reject('not found');
+ defer.reject({ message : 'not found', url : params.url });
return;
}
@@ -37,11 +37,11 @@ module.exports = function(defer, params) {
defer.resolve(processResponse(body, params.dataType));
}
catch(e) {
- defer.reject(e.message);
+ defer.reject({ message : e.message, url : params.url });
}
})
.on('close', function(e) {
- defer.reject(e.message);
+ defer.reject({ message : e.message, url : params.url });
});
});
View
1  lib/jaggi.js
@@ -19,7 +19,6 @@ module.exports = {
server.configure(function() {
server.use(express.profiler());
server.set('config', require(params.configsPath + server.settings.env));
- server.use(server.router);
server.use(express.bodyParser());
server.use(express.methodOverride());
});
View
15 lib/runner.js
@@ -60,22 +60,21 @@ var Q = require('q'),
return;
}
+ var params = this._buildRunParams(block.params);
+
+ if(typeof block.content === 'object') {
+ return new Runner(block.content, new Ctx(utils.merge(this._ctx.params(), { state : new State(params) })))
+ .run();
+ }
+
var defer = Q.defer();
- var params = this._buildRunParams(block.params);
if(typeof block.content === 'string') {
require('./block/' + block.content)(defer, params);
}
else if(utils.isFunction(block.content)) {
block.content(defer, params);
}
- else if(typeof block.content === 'object') {
- new Runner(block.content, new Ctx(utils.merge(this._ctx.params(), { state : new State(params) })))
- .run()
- .then(function(res) {
- defer.resolve(res);
- });
- }
return defer.promise;
View
23 pages/test.js
@@ -1,6 +1,15 @@
module.exports = {
blocks : {
+ 'second' : {
+ deps : ['first'],
+ params : function(ctx) {
+ return { test : ctx.state().param('test') };
+ },
+ content : function(defer, params) {
+ defer.resolve(params.test);
+ }
+ },
'first' : {
timeout : 1000,
params : function(ctx) {
@@ -14,15 +23,6 @@ module.exports = {
//return false;
}
},
- 'second' : {
- deps : ['first'],
- params : function(ctx) {
- return { test : ctx.state().param('test') };
- },
- content : function(defer, params) {
- defer.resolve(params.test);
- }
- },
'http' : {
content : 'http',
params : function(ctx) {
@@ -52,6 +52,11 @@ module.exports = {
}
}
}
+ },
+ 'static' : {
+ content : function(defer) {
+ defer.resolve({ staticData : true });
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.