Skip to content

Commit

Permalink
add better error message for #397
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Oct 23, 2023
1 parent 99d2a8f commit 519a2db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions looper/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ def __init__(self, key):
super(MisconfigurationException, self).__init__(key)


class RegistryPathException(LooperError):
"""Duplication of pipeline identifier precludes unique pipeline ref."""

def __init__(self, msg):
super(RegistryPathException, self).__init__(msg)


class DuplicatePipelineKeyException(LooperError):
"""Duplication of pipeline identifier precludes unique pipeline ref."""

Expand Down
11 changes: 8 additions & 3 deletions looper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pydantic.error_wrappers import ValidationError

from .const import *
from .exceptions import MisconfigurationException
from .exceptions import MisconfigurationException, RegistryPathException

_LOGGER = getLogger(__name__)

Expand Down Expand Up @@ -555,8 +555,13 @@ def is_registry_path(input_string: str) -> bool:
:param str input_string: path to the PEP (or registry path)
:return bool: True if input is a registry path
"""
if input_string.endswith(".yaml"):
return False
try:
if input_string.endswith(".yaml"):
return False
except AttributeError:
raise RegistryPathException(
msg=f"Malformed registry path. Unable to parse {input_string} as a registry path."
)
try:
registry_path = RegistryPath(**parse_registry_path(input_string))
except (ValidationError, TypeError):
Expand Down

0 comments on commit 519a2db

Please sign in to comment.