Permalink
Browse files

Add check if store is available.

  • Loading branch information...
1 parent 32fbcf5 commit 162a1bcc6ebe9dbd9c5c53a74b73aeaaea9a94ff @mape committed Sep 6, 2011
Showing with 6 additions and 2 deletions.
  1. +5 −1 lib/caching.js
  2. +1 −1 package.json
View
6 lib/caching.js
@@ -2,7 +2,11 @@ module.exports = function Caching(store) {
store = store || 'memory';
if (typeof store == 'string') {
- store = require('./stores/'+store.toLowerCase().trim())(arguments[1]);
+ try {
+ store = require('./stores/'+store.toLowerCase().trim())(arguments[1]);
+ } catch(e) {
+ throw new Error('There is no bundled caching store named "'+store+'"');
+ }
}
var queues = {};
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "caching",
"description": "Easier caching in node.js",
- "version": "0.1.3",
+ "version": "0.1.4",
"author": "Mathias Pettersson <mape@mape.me>",
"engines": [
"node"

0 comments on commit 162a1bc

Please sign in to comment.