diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-11-08 14:16:37 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-11-08 14:46:09 -1000 |
commit | c9f375a151cc8caa74c341f054e8a3e0cdc96b52 (patch) | |
tree | cd5c730fc6bc29f5483e9612e7cfe0b3066c46bd | |
parent | cd7ba4c502956c3e39d127492732ba6f95cb33e5 (diff) | |
download | patchfoo-c9f375a151cc8caa74c341f054e8a3e0cdc96b52.tar.gz patchfoo-c9f375a151cc8caa74c341f054e8a3e0cdc96b52.zip |
Handle synchronous error in ssb.get
-rw-r--r-- | lib/app.js | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -491,13 +491,17 @@ function getMsgWithValue(sbot, id, cb) { var parts = id.split('?unbox=') id = parts[0] var unbox = parts[1] && parts[1].replace(/ /g, '+') - sbotGet(sbot, id, function (err, value) { - if (err) return cb(err) - var msg = {key: id, value: value} - if (unbox && value && typeof value.content === 'string') - return self.app.unboxMsgWithKey(msg, unbox, cb) - cb(null, msg) - }) + try { + sbotGet(sbot, id, function (err, value) { + if (err) return cb(err) + var msg = {key: id, value: value} + if (unbox && value && typeof value.content === 'string') + return self.app.unboxMsgWithKey(msg, unbox, cb) + cb(null, msg) + }) + } catch(e) { + return cb(e) + } } App.prototype._getAbout = function (id, cb) { |