diff --git a/lib/asteroid.js b/lib/asteroid.js index 8befe3fb..ecf67f9e 100644 --- a/lib/asteroid.js +++ b/lib/asteroid.js @@ -179,7 +179,18 @@ asteroid.createModel = function (name, properties, options) { } else if(data) { fn(null, new ModelCtor(data)); } else if(id) { - ModelCtor.find(id, fn); + ModelCtor.find(id, function (err, model) { + if(err) { + fn(err); + } else if(model) { + fn(null, model); + } else { + err = new Error('could not find a model with id ' + id); + err.statusCode = 404; + + fn(err); + } + }); } else { fn(new Error('must specify an id or data')); }