summaryrefslogtreecommitdiff
path: root/gitlab/mixins.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2017-12-16 07:00:56 +0100
committerGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2017-12-16 07:00:56 +0100
commit2167409fd6388be6758ae71762af88a466ec648d (patch)
treeb47e04f8260422a0150afee25e532065b497adc4 /gitlab/mixins.py
parentb775069bcea51c0813a57e220c387623f361c488 (diff)
downloadgitlab-2167409fd6388be6758ae71762af88a466ec648d.tar.gz
Make todo() raise GitlabTodoError on error
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r--gitlab/mixins.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py
index 3d6e321..c9243ed 100644
--- a/gitlab/mixins.py
+++ b/gitlab/mixins.py
@@ -113,7 +113,12 @@ class GetFromListMixin(ListMixin):
GitlabAuthenticationError: If authentication is not correct
GitlabGetError: If the server cannot perform the request
"""
- gen = self.list()
+ try:
+ gen = self.list()
+ except exc.GitlabListError:
+ raise exc.GitlabGetError(response_code=404,
+ error_message="Not found")
+
for obj in gen:
if str(obj.get_id()) == str(id):
return obj
@@ -382,7 +387,7 @@ class SubscribableMixin(object):
class TodoMixin(object):
@cli.register_custom_action(('ProjectIssue', 'ProjectMergeRequest'))
- @exc.on_http_error(exc.GitlabHttpError)
+ @exc.on_http_error(exc.GitlabTodoError)
def todo(self, **kwargs):
"""Create a todo associated to the object.