aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-09-05 20:55:30 -0700
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-09-06 14:14:13 -0700
commit047e5cb16c3c236e356818f8d6fd979e94dadce6 (patch)
tree3711cb5c3505708503707c0696e3f69cac8dd568 /lib
parent471c40a1310d3ca0bc6d8c220c4c174543a8c510 (diff)
downloadpatchfoo-047e5cb16c3c236e356818f8d6fd979e94dadce6.tar.gz
patchfoo-047e5cb16c3c236e356818f8d6fd979e94dadce6.zip
Catch sync error in sbot.get
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js16
1 files changed, 10 insertions, 6 deletions
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) {