aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/app.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/app.js b/lib/app.js
index 4119179..3d8d507 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -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) {