mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
metrics/params diff: catch NoSCMError instead of a broad exception
instead of catching broad exception, NoSCMError should work here.
This commit is contained in:
committed by
Saugat Pachhai
parent
644e9ede92
commit
7dc5420548
@@ -7,7 +7,7 @@ from dvc.output import Output
|
||||
from dvc.repo import locked
|
||||
from dvc.repo.collect import StrPaths, collect
|
||||
from dvc.repo.live import summary_fs_path
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.scm.base import NoSCMError
|
||||
from dvc.utils import error_handler, errored_revisions, onerror_collect
|
||||
from dvc.utils.serialize import load_yaml
|
||||
|
||||
@@ -121,9 +121,9 @@ def show(
|
||||
# Hide workspace metrics if they are the same as in the active branch
|
||||
try:
|
||||
active_branch = repo.scm.active_branch()
|
||||
except (TypeError, SCMError):
|
||||
except (TypeError, NoSCMError):
|
||||
# TypeError - detached head
|
||||
# SCMError - no repo case
|
||||
# NoSCMError - no repo case
|
||||
pass
|
||||
else:
|
||||
if res.get("workspace") == res.get(active_branch):
|
||||
|
||||
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Tuple
|
||||
from dvc.dependency.param import ParamsDependency
|
||||
from dvc.repo import locked
|
||||
from dvc.repo.collect import collect
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.scm.base import NoSCMError
|
||||
from dvc.stage import PipelineStage
|
||||
from dvc.ui import ui
|
||||
from dvc.utils import error_handler, errored_revisions, onerror_collect
|
||||
@@ -113,9 +113,9 @@ def show(repo, revs=None, targets=None, deps=False, onerror: Callable = None):
|
||||
# Hide workspace params if they are the same as in the active branch
|
||||
try:
|
||||
active_branch = repo.scm.active_branch()
|
||||
except (TypeError, SCMError):
|
||||
except (TypeError, NoSCMError):
|
||||
# TypeError - detached head
|
||||
# SCMError - no repo case
|
||||
# NoSCMError - no repo case
|
||||
pass
|
||||
else:
|
||||
if res.get("workspace") == res.get(active_branch):
|
||||
|
||||
Reference in New Issue
Block a user