Skip to content

Commit

Permalink
v0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
luiseduardobrito committed Sep 16, 2013
1 parent 63d7647 commit 5d792a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions api/adapters/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ var Model = function(type) {
if(model[k].default)
obj[k] = generate_default(model[k].default)
else
throw new Error("Error parsing required field '"+k+"'. "+e);
throw new Error("Could not parse required field '" + k + "'. " + e.message.toString());
}
}
else {
Expand Down Expand Up @@ -331,14 +331,14 @@ var Model = function(type) {
}, function(err, docs) {

if(err)
throw new Error("Problem querying database. " + err.toString());
throw new Error("Problem querying database. " + err.message.toString());

if(!docs || docs.length == 0) {

db.save(obj, function(err, obj){

if(err)
throw new Error("Problem querying database. " + err.toString());
throw new Error("Problem querying database. " + err.message.toString());

cb(true);
});
Expand All @@ -351,7 +351,7 @@ var Model = function(type) {
}, obj, {multi:false}, function(err) {

if(err)
throw new Error("Problem querying database. " + err.toString());
throw new Error("Problem querying database. " + err.message.toString());

cb(true);
});
Expand Down
8 changes: 4 additions & 4 deletions api/controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {

response(res).json({
result: "error",
message: e.toString()
message: e.message.toString()
})

return;
Expand Down Expand Up @@ -88,7 +88,7 @@ module.exports = {

response(res).json({
result: "error",
message: e.toString()
message: e.message.toString()
})

return;
Expand Down Expand Up @@ -134,11 +134,11 @@ module.exports = {
return;
});
}
catch(err) {
catch(e) {

response(res).json({
result: "error",
message: err.toString()
message: e.message.toString()
});
}
},
Expand Down
5 changes: 2 additions & 3 deletions client/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
var signup = function(data) {

// prepare successful login callback
broadcast.subscribe("user/signup/success", function(data) {
broadcast.once("user/signup/success", function(data) {

alert("Result: " + data.message || "User created successfully");

Expand All @@ -93,7 +93,7 @@
});

// prepare error login callback
broadcast.subscribe("user/signup/error", function(data) {
broadcast.once("user/signup/error", function(data) {
alert("Error: "+ data.message || "unknown error.");
});

Expand All @@ -105,7 +105,6 @@
password: $("#password").val()

}, function(response) {

broadcast.publish("user/signup/" + response.result, response || {});
});

Expand Down

0 comments on commit 5d792a9

Please sign in to comment.