Skip to content

Commit

Permalink
Make sure to pass errors back up the chain
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean McCullough committed Sep 10, 2013
1 parent 9d54da9 commit 831ac19
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/connect-memcached.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ module.exports = function(connect) {
sid = this.getKey(sid);

this.client.get(sid, function(err, data) {
if (err) { return fn(err, {}); }
try {
if (!data) {
return fn();
}
fn(null, JSON.parse(data.toString()));
} catch (err) {
fn(err);
} catch (e) {
fn(e);
}
});
};
Expand Down

0 comments on commit 831ac19

Please sign in to comment.