diff --git a/renku/ui/service/errors.py b/renku/ui/service/errors.py index 961718bf9c..20e4f9ae85 100644 --- a/renku/ui/service/errors.py +++ b/renku/ui/service/errors.py @@ -121,7 +121,7 @@ def _handle_sentry(self): sentry_target = sentry_url.netloc.split("@")[-1] # NOTE: sentry doesn't support a global search. A proper link would require the specific org sentry = f"{sentry_url.scheme }://{sentry_target}/organizations/sentry?query={sentry}" - except Exception: + except Exception: # nosec pass except KeyError as e: sentry = f"Unexpected error while reporting to Sentry: {str(e)}" @@ -348,6 +348,19 @@ def __init__(self, exception=None): super().__init__(exception=exception) +class UserDatasetsNotFoundError(ServiceError): + """Dataset could't be found in project.""" + + code = SVC_ERROR_USER + 133 + userMessage = ( + "The dataset doesn't exist in the project. Please check your inputs or create the target dataset first." + ) + devMessage = "The dataset couldn't be found in the project." + + def __init__(self, exception=None): + super().__init__(exception=exception) + + class UserOutdatedProjectError(ServiceError): """The operation can be done only after updating the target project.""" diff --git a/renku/ui/service/views/error_handlers.py b/renku/ui/service/views/error_handlers.py index 5cfab9e0bc..d56de3bbfc 100644 --- a/renku/ui/service/views/error_handlers.py +++ b/renku/ui/service/views/error_handlers.py @@ -28,6 +28,7 @@ AuthenticationError, DatasetExistsError, DatasetImageError, + DatasetNotFound, DockerfileUpdateError, GitCommandError, GitError, @@ -65,6 +66,7 @@ ProgramUpdateProjectError, ServiceError, UserDatasetsMultipleImagesError, + UserDatasetsNotFoundError, UserDatasetsUnlinkError, UserDatasetsUnreachableImageError, UserInvalidGenericFieldsError, @@ -368,6 +370,8 @@ def decorated_function(*args, **kwargs): if "".join(value) == "Field may not be null.": raise UserMissingFieldError(e, key) raise + except DatasetNotFound as e: + raise UserDatasetsNotFoundError(e) except DatasetExistsError as e: raise IntermittentDatasetExistsError(e) except RenkuException as e: