diff --git a/pagure/exceptions.py b/pagure/exceptions.py index 8764baf..e02abd6 100644 --- a/pagure/exceptions.py +++ b/pagure/exceptions.py @@ -68,3 +68,8 @@ class NoCorrespondingPR(PagureException): ''' Exception raised when no pull-request is found with the given information. ''' pass + + +class InvalidObjetException(PagureException): + ''' Exception raised when a given object is not what was expected. ''' + pass diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index da2f3e9..1c9cd62 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -3219,6 +3219,10 @@ def set_watch_obj(session, user, obj, watch_status): pull_request_uid=obj.uid, watch=watch_status, ) + else: + raise pagure.exceptions.InvalidObjetException( + 'Unknow watch target: "%s"' % obj + ) session.add(dbobj)