Commit a2e6e922f8d9cb98c60e57c51b85a3fc9aad8494
throw immediately when `db.get` called with a non-ref string
Matt McKegg authored on 6/26/2017, 5:16:39 AMGitHub committed on 6/26/2017, 5:16:39 AM
Parent: c6d8011081748fa1a8ad7ef5100a3f947ef9d112
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -88,9 +88,12 @@ | ||
88 | 88 | return db.keys.get(key, function (err, seq) { |
89 | 89 | if(err) cb(err) |
90 | 90 | else cb(null, seq && seq.value) |
91 | 91 | }) |
92 | - else _get(key, cb) //seq | |
92 | + else if(typeof key === 'number') | |
93 | + _get(key, cb) //seq | |
94 | + else | |
95 | + cb(new Error('Invalid key. You must call `get` with with an ssb ref or flume offset')) | |
93 | 96 | } |
94 | 97 | |
95 | 98 | var add = Validator(db, opts) |
96 | 99 | db.add = function (msg, cb) { |
Built with git-ssb-web