diff --git a/readthedocs/core/utils/__init__.py b/readthedocs/core/utils/__init__.py index 896f7f26258..b9058a54b08 100644 --- a/readthedocs/core/utils/__init__.py +++ b/readthedocs/core/utils/__init__.py @@ -18,7 +18,6 @@ from readthedocs.builds.constants import BUILD_STATE_TRIGGERED from readthedocs.doc_builder.constants import DOCKER_LIMITS -from readthedocs.projects.exceptions import InvalidParamsException log = logging.getLogger(__name__) @@ -35,7 +34,7 @@ def broadcast(type, task, args, kwargs=None, callback=None): # pylint: disable= after all of the broadcast tasks have finished running. """ if type not in ['web', 'app', 'build']: - raise InvalidParamsException('allowed value of `type` are web, app and build.') + raise ValueError('allowed value of `type` are web, app and build.') if kwargs is None: kwargs = {} default_queue = getattr(settings, 'CELERY_DEFAULT_QUEUE', 'celery') diff --git a/readthedocs/projects/exceptions.py b/readthedocs/projects/exceptions.py index d354266d164..85b439400df 100644 --- a/readthedocs/projects/exceptions.py +++ b/readthedocs/projects/exceptions.py @@ -60,10 +60,3 @@ class ProjectSpamError(Exception): This error is not raised to users, we use this for banning users in the background. """ - - -class InvalidParamsException(Exception): - - """Error raised when incorrect parameters are passed to a function/class.""" - - pass diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index c9f8e1c24ea..71c2519c580 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -67,7 +67,7 @@ from readthedocs.worker import app from .constants import LOG_TEMPLATE -from .exceptions import ProjectConfigurationError, RepositoryError, InvalidParamsException +from .exceptions import ProjectConfigurationError, RepositoryError from .models import Domain, HTMLFile, ImportedFile, Project from .signals import ( after_build, @@ -102,7 +102,7 @@ def get_version(project=None, version_pk=None): :rtype: builds.models.APIVersion """ if not (project or version_pk): - raise InvalidParamsException('project or version_pk is needed') + raise ValueError('project or version_pk is needed') if version_pk: version_data = api_v2.version(version_pk).get() else: diff --git a/readthedocs/search/tasks.py b/readthedocs/search/tasks.py index f3c55935307..b4561ad5dca 100644 --- a/readthedocs/search/tasks.py +++ b/readthedocs/search/tasks.py @@ -4,7 +4,6 @@ from django_elasticsearch_dsl.registries import registry from readthedocs.worker import app -from readthedocs.projects.exceptions import InvalidParamsException from .utils import _get_index, _get_document log = logging.getLogger(__name__) @@ -16,10 +15,10 @@ def index_objects_to_es( ): if chunk and objects_id: - raise InvalidParamsException('You can not pass both chunk and objects_id.') + raise ValueError('You can not pass both chunk and objects_id.') if not (chunk or objects_id): - raise InvalidParamsException('You must pass a chunk or objects_id.') + raise ValueError('You must pass a chunk or objects_id.') model = apps.get_model(app_label, model_name) document = _get_document(model=model, document_class=document_class)