From 047e5cb16c3c236e356818f8d6fd979e94dadce6 Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 5 Sep 2018 20:55:30 -0700 Subject: Catch sync error in sbot.get --- lib/app.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/app.js b/lib/app.js index c647d39..6bfa00a 100644 --- a/lib/app.js +++ b/lib/app.js @@ -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) { -- cgit v1.2.3