mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
exceptions: use semantic exceptions (#3430)
This commit is contained in:
@@ -325,3 +325,7 @@ class RemoteCacheRequiredError(DvcException):
|
||||
format_link("https://man.dvc.org/config#cache"),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class IsADirectoryError(DvcException):
|
||||
"""Raised when a file operation is requested on a directory."""
|
||||
|
||||
@@ -10,6 +10,7 @@ from funcy import cached_property, cat, first
|
||||
from dvc.config import Config
|
||||
from dvc.exceptions import (
|
||||
FileMissingError,
|
||||
IsADirectoryError,
|
||||
NotDvcRepoError,
|
||||
OutputNotFoundError,
|
||||
)
|
||||
@@ -476,7 +477,7 @@ class Repo(object):
|
||||
|
||||
def _open_cached(self, out, remote=None, mode="r", encoding=None):
|
||||
if out.isdir():
|
||||
raise ValueError("Can't open a dir")
|
||||
raise IsADirectoryError("Can't open a dir")
|
||||
|
||||
cache_file = self.cache.local.checksum_to_path_info(out.checksum)
|
||||
cache_file = fspath_py35(cache_file)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import logging
|
||||
|
||||
from dvc.exceptions import ReproductionError
|
||||
from dvc.exceptions import ReproductionError, InvalidArgumentError
|
||||
from dvc.repo.scm_context import scm_context
|
||||
from . import locked
|
||||
from .graph import get_pipeline, get_pipelines
|
||||
@@ -61,7 +61,9 @@ def reproduce(
|
||||
from dvc.stage import Stage
|
||||
|
||||
if not target and not all_pipelines:
|
||||
raise ValueError()
|
||||
raise InvalidArgumentError(
|
||||
"Neither target nor all_pipelines are specified."
|
||||
)
|
||||
|
||||
interactive = kwargs.get("interactive", False)
|
||||
if not interactive:
|
||||
|
||||
Reference in New Issue
Block a user