Comparing version 0.4.4 to 0.4.5
@@ -45,3 +45,3 @@ var _ = require('underscore') | ||
processQuery(projectionName, result, filterObj, cb) | ||
processQuery(projectionName, result, filterObj.obj || filterObj, cb) | ||
} | ||
@@ -48,0 +48,0 @@ |
@@ -27,2 +27,3 @@ var path = require('path') | ||
, key = keys(projectionName, eventData) | ||
, filter | ||
@@ -41,17 +42,27 @@ function executeHandler(projectionName, state) { | ||
handler.call(context, state, eventData) | ||
try { | ||
handler.call(context, state, eventData) | ||
storage.eventResult(projectionName, position, state, function(err) { | ||
if(err) console.log(err) | ||
}) | ||
storage.eventResult(projectionName, position, state, function(err) { | ||
if(err) console.log(err) | ||
}) | ||
} | ||
catch(ex) { | ||
console.error('Error in bjorling handler: ', projectionName, context, state, eventData) | ||
} | ||
} | ||
if(key) { | ||
return executeHandler(projectionName, storage.getState(projectionName, key)) | ||
} | ||
try { | ||
if(key) { | ||
return executeHandler(projectionName, storage.getState(projectionName, key)) | ||
} | ||
var filter = filters(projectionName, eventData) | ||
if(filter) { | ||
return executeHandler(projectionName, storage.getState(projectionName, filter)) | ||
filter = filters(projectionName, eventData) | ||
if(filter) { | ||
return executeHandler(projectionName, storage.getState(projectionName, filter)) | ||
} | ||
} | ||
catch(ex) { | ||
console.error(key, filter, ex) | ||
} | ||
} | ||
@@ -58,0 +69,0 @@ |
@@ -33,3 +33,3 @@ { | ||
, "main": "./bjorling.js" | ||
, "version": "0.4.4" | ||
, "version": "0.4.5" | ||
} |
18818
553