Jforrester has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/242369

Change subject: get_slug_PHID: Catch list being empty and throw explanation
......................................................................

get_slug_PHID: Catch list being empty and throw explanation

Change-Id: Ie281f810c598e9b08e521275d16f7939e52b622c
---
M forrestbot.py
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/forrestbot 
refs/changes/69/242369/1

diff --git a/forrestbot.py b/forrestbot.py
index cfe8968..935d540 100644
--- a/forrestbot.py
+++ b/forrestbot.py
@@ -80,9 +80,13 @@
 
 @functools.lru_cache()
 def get_slug_PHID(slug):
-    rq = list(
-        phab.request('project.query', {'slugs': [slug]})['slugMap'].values()
-    )
+    try:
+        rq = list(
+            phab.request('project.query', {'slugs': [slug]})['slugMap']
+                .values()
+        )
+    except AttributeError:
+        raise Exception("No PHID found for slug #%s!" % slug)
     if rq:
         logging.debug(
             "Slug {slug} = PHID {phid}".format(slug=slug, phid=rq[0])

-- 
To view, visit https://gerrit.wikimedia.org/r/242369
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie281f810c598e9b08e521275d16f7939e52b622c
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/forrestbot
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to