git ssb

0+

Kira / %V53yIAO6ZNGv1Lx9tCP…



forked from cel / ssb-issues

Commit ed69a5746faddfaf67c23a161fd8b8ba883b89f5

Catch synchronous errors

Charles Lehner committed on 3/27/2016, 2:30:19 AM
Parent: 67d934ea080c9e5e1fe6ab36f5709c6977e3a111

Files changed

index.jschanged
index.jsView
@@ -199,21 +199,30 @@
199199 )
200200 }
201201
202202 function editIssue(id, opts, cb) {
203- ssb.publish(issueSchemas.edit(id, opts), cb)
203+ var msg
204+ try { ssb.publish(issueSchemas.edit(id, opts), cb) }
205+ catch(e) { return cb(e) }
204206 }
205207
206208 function closeIssue(id, cb) {
207- ssb.publish(issueSchemas.close(id), cb)
209+ var msg
210+ try { ssb.publish(issueSchemas.close(id), cb) }
211+ catch(e) { return cb(e) }
208212 }
209213
210214 function reopenIssue(id, cb) {
211- ssb.publish(issueSchemas.reopen(id), cb)
215+ var msg
216+ try { msg = issueSchemas.reopen(id) }
217+ catch(e) { return cb(e) }
218+ ssb.publish(msg, cb)
212219 }
213220
214221 function newIssue(opts, cb) {
215- var msg = issueSchemas.new(opts.project, opts.title, opts.text)
222+ var msg
223+ try { msg = issueSchemas.new(opts.project, opts.title, opts.text) }
224+ catch(e) { return cb(e) }
216225 ssb.publish(msg, function (err, msg) {
217226 if (err) return cb(err)
218227 getIssue(msg, cb)
219228 })

Built with git-ssb-web