metrics/params diff: catch NoSCMError instead of a broad exception

instead of catching broad exception, NoSCMError should work here.
This commit is contained in:
Saugat Pachhai (सौगात)
2021-11-23 13:21:15 +05:45
committed by Saugat Pachhai
parent 644e9ede92
commit 7dc5420548
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -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):
+3 -3
View File
@@ -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):