Skip to content
Browse files

throw new Error's instead of just err's

  • Loading branch information...
1 parent 1256b33 commit 53b10d84cea4930bb2916104ee569e6e9fb569cb @pkrumins committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/cart.js
View
8 lib/cart.js
@@ -13,7 +13,7 @@ function Cart(options) {
var dbFile = options.dbFile || __dirname + "/sessions.db";
ConnectStore.call(this, options);
Store({ filename : dbFile, json : true }, function (err, db) {
- if (err) throw err;
+ if (err) throw new Error(err);
self.db = db;
db.filter(
function (key, item) {
@@ -30,7 +30,7 @@ sys.inherits(Cart, ConnectStore);
Cart.prototype.get = function (hash, fn) {
this.db.get(hash, function (err, val) {
- if (err) throw err;
+ if (err) throw new Error(err);
if (val) {
fn(null, val);
}
@@ -42,14 +42,14 @@ Cart.prototype.get = function (hash, fn) {
Cart.prototype.set = function (hash, sess, fn) {
this.db.set(hash, sess, function (err) {
- if (err) throw err;
+ if (err) throw new Error(err);
if (fn) fn();
});
};
Cart.prototype.destroy = function (hash, fn) {
this.db.remove(hash, function (err) {
- if (err) throw err;
+ if (err) throw new Error(err);
if (fn) fn();
});
};

0 comments on commit 53b10d8

Please sign in to comment.
Something went wrong with that request. Please try again.