Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: a bug in yukari delete
  • Loading branch information
XadillaX committed Oct 12, 2016
1 parent 6923a1a commit 5446a64
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/yukari.js
Expand Up @@ -178,7 +178,7 @@ class Yukari {
if(callback === undefined) callback = _emptyCallback;

if(this.$source === "new") {
return callback(new Error("You must call this function via a new Yukari object."));
return callback(new Error("You can't call this function via a new Yukari object."));
}

let pk;
Expand All @@ -198,14 +198,11 @@ class Yukari {
}, {});
}

const self = this;
this.$model.where(pk).limit("0, 1").delete(function(err, result, sql) {
if(err) return callback(err);
if(!result) return callback(new Error("unknown error."));
if(!result.affectedRows) {
return callback(new Error("Out-dated yukari object."));
}

this.$source = "delete";
self.$source = "delete";
return callback(undefined, true, sql);
});
}
Expand Down

0 comments on commit 5446a64

Please sign in to comment.