Commit ed69a5746faddfaf67c23a161fd8b8ba883b89f5
Catch synchronous errors
Charles Lehner committed on 3/27/2016, 2:30:19 AMParent: 67d934ea080c9e5e1fe6ab36f5709c6977e3a111
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -199,21 +199,30 @@ | ||
199 | 199 | ) |
200 | 200 | } |
201 | 201 | |
202 | 202 | 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) } | |
204 | 206 | } |
205 | 207 | |
206 | 208 | 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) } | |
208 | 212 | } |
209 | 213 | |
210 | 214 | 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) | |
212 | 219 | } |
213 | 220 | |
214 | 221 | 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) } | |
216 | 225 | ssb.publish(msg, function (err, msg) { |
217 | 226 | if (err) return cb(err) |
218 | 227 | getIssue(msg, cb) |
219 | 228 | }) |
Built with git-ssb-web