diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-09-05 20:55:30 -0700 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-09-06 14:14:13 -0700 |
commit | 047e5cb16c3c236e356818f8d6fd979e94dadce6 (patch) | |
tree | 3711cb5c3505708503707c0696e3f69cac8dd568 | |
parent | 471c40a1310d3ca0bc6d8c220c4c174543a8c510 (diff) | |
download | patchfoo-047e5cb16c3c236e356818f8d6fd979e94dadce6.tar.gz patchfoo-047e5cb16c3c236e356818f8d6fd979e94dadce6.zip |
Catch sync error in sbot.get
-rw-r--r-- | lib/app.js | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -352,12 +352,16 @@ App.prototype.getNameSync = function (name) { function sbotGet(sbot, id, cb) { // try sbot.get via ssb-ooo a50da3928500f3ac0fbead0a1b335a3dd5bbc096 first - sbot.get({id: id, raw: true}, function (err, value) { - if (err && err.message === 'Param 0 must by of type number') { - return sbot.get(id, cb) - } - cb(err, value) - }) + try { + sbot.get({id: id, raw: true}, function (err, value) { + if (err && /^Param 0/.test(err.message)) { + return sbot.get(id, cb) + } + cb(err, value) + }) + } catch(e) { + cb(e) + } } function getMsgWithValue(sbot, id, cb) { |