Skip to content

Commit

Permalink
fix again error detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mose committed Jul 21, 2016
1 parent e88e476 commit ddb305a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Hubot-phabs Changelog
==========================

### 1.0.2 - 2016-07-21
- fix error detection (yeah, again)

### 1.0.1 - 2016-07-21
- add a .phab paste some new paste
- fix error handling
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hubot-phabs",
"description": "A hubot plugin for communication with a Phabricator instance.",
"version": "1.0.1",
"version": "1.0.2",
"author": {
"name": "mose",
"email": "mose@gandi.net",
Expand Down
24 changes: 12 additions & 12 deletions scripts/phabs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ module.exports = (robot) ->
msg.finish()
return
phab.taskInfo msg, id, (body) ->
if body['error_info'] is undefined
if body['error_info']?
msg.send "oops T#{id} #{body['error_info']}"
else
phab.withUserByPhid robot, body.result.ownerPHID, (owner) ->
status = body.result.status
priority = body.result.priority
phab.recordPhid msg, id
msg.send "T#{id} has status #{status}, " +
"priority #{priority}, owner #{owner.name}"
else
msg.send "oops T#{id} #{body['error_info']}"
msg.finish()


Expand All @@ -128,10 +128,10 @@ module.exports = (robot) ->
return
status = msg.match[2]
phab.updateStatus msg, id, status, (body) ->
if body['error_info'] is undefined
msg.send "Ok, T#{id} now has status #{body['result']['statusName']}."
else
if body['error_info']?
msg.send "oops T#{id} #{body['error_info']}"
else
msg.send "Ok, T#{id} now has status #{body['result']['statusName']}."
msg.finish()


Expand All @@ -145,10 +145,10 @@ module.exports = (robot) ->
return
priority = msg.match[2]
phab.updatePriority msg, id, priority, (body) ->
if body['error_info'] is undefined
msg.send "Ok, T#{id} now has priority #{body['result']['priority']}"
else
if body['error_info']?
msg.send "oops T#{id} #{body['error_info']}"
else
msg.send "Ok, T#{id} now has priority #{body['result']['priority']}"
msg.finish()


Expand Down Expand Up @@ -197,10 +197,10 @@ module.exports = (robot) ->
if assignee?
phab.withUser msg, assignee, (userPhid) ->
phab.assignTask msg, id, userPhid, (body) ->
if body['error_info'] is undefined
msg.send "Ok. T#{id} is now assigned to #{assignee.name}"
else
if body['error_info']?
msg.send "#{body['error_info']}"
else
msg.send "Ok. T#{id} is now assigned to #{assignee.name}"
else
msg.send "Sorry I don't know who is #{who}, can you .phab #{who} = <email>"
msg.finish()
Expand Down

0 comments on commit ddb305a

Please sign in to comment.