Skip to content

Commit

Permalink
Check for the short_name parameter being None in Schema.get_type_by_s…
Browse files Browse the repository at this point in the history
…hort_name.
  • Loading branch information
alexandervsokol committed Oct 21, 2024
1 parent be8a9cb commit aac2577
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cl/runtime/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from memoization import cached
from typing_extensions import Self
from cl.runtime.primitive.case_util import CaseUtil
from cl.runtime.primitive.string_util import StringUtil
from cl.runtime.records.class_info import ClassInfo
from cl.runtime.records.protocols import KeyProtocol
from cl.runtime.schema.type_decl import TypeDecl
Expand Down Expand Up @@ -71,6 +72,8 @@ def add_types_to_dict_by_short_name(cls, types: Iterable[Type]) -> None:
@classmethod
def get_type_by_short_name(cls, short_name: str) -> Type:
"""Get type from short name (class name with optional package alias)."""
if StringUtil.is_empty(short_name):
raise RuntimeError("Empty short name is passed to Schema.get_type_by_short_name.")

# Get dictionary of types indexed by alias
type_dict_by_short_name = cls.get_type_dict()
Expand Down

0 comments on commit aac2577

Please sign in to comment.