Skip to content

Commit

Permalink
handle custom exception for pydantic
Browse files Browse the repository at this point in the history
  • Loading branch information
harshsoni2024 committed Aug 9, 2024
1 parent 2748a64 commit b708c9d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import Iterable, Optional, Tuple, Union

from pydantic import EmailStr
from pydantic_core import PydanticCustomError
from pyhive.sqlalchemy_hive import _type_map
from sqlalchemy import types, util
from sqlalchemy.engine import reflection
Expand Down Expand Up @@ -694,7 +695,7 @@ def get_owner_ref(self, table_name: str) -> Optional[EntityReferenceList]:
try:
owner_email = EmailStr._validate(owner)
owner_ref = self.metadata.get_reference_by_email(email=owner_email)
except Exception:
except PydanticCustomError:
owner_ref = self.metadata.get_reference_by_name(name=owner)
return owner_ref
except Exception as exc:
Expand Down

0 comments on commit b708c9d

Please sign in to comment.