summaryrefslogtreecommitdiff
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
parentb775069bcea51c0813a57e220c387623f361c488 (diff)
downloadgitlab-2167409fd6388be6758ae71762af88a466ec648d.tar.gz
Make todo() raise GitlabTodoError on error
-rw-r--r--RELEASE_NOTES.rst1
-rw-r--r--gitlab/mixins.py9
2 files changed, 8 insertions, 2 deletions
diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst
index 2d6a05c..a9008f7 100644
--- a/RELEASE_NOTES.rst
+++ b/RELEASE_NOTES.rst
@@ -16,6 +16,7 @@ Changes from 1.1 to 1.2
``set_token`` and ``set_credentials`` methods. Once a Gitlab object has been
created its URL and authentication information cannot be updated: create a
new Gitlab object if you need to use new information
+* The ``todo()`` method raises a ``GitlabTodoError`` exception on error
Changes from 1.0.2 to 1.1
=========================
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.