Skip to content

Commit

Permalink
Add more failsafes
Browse files Browse the repository at this point in the history
  • Loading branch information
lloesche committed Sep 19, 2024
1 parent 189352c commit ce6d806
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fixattiosync/attiodata.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import os
import requests
from uuid import UUID
Expand Down Expand Up @@ -118,6 +119,9 @@ def hydrate(self) -> None:
self.__people = self.__marshal(self._records("people"), AttioPerson) # type: ignore
self.__users = self.__marshal(self._records("users"), AttioUser) # type: ignore
self.__connect()
if len(self.__workspaces) == 0 or len(self.__people) == 0 or len(self.__users) == 0:
log.fatal("No data found in Attio")
sys.exit(3)
self.hydrated = True

def __connect(self) -> None:
Expand Down
3 changes: 3 additions & 0 deletions fixattiosync/fixdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ def hydrate(self) -> None:
self.close()
log.debug(f"Found {len(self.__workspaces)} workspaces in database")
log.debug(f"Found {len(self.__users)} users in database")
if len(self.__users) == 0 or len(self.__workspaces) == 0:
log.fatal("No data found in Fix database")
sys.exit(2)
self.hydrated = True

def close(self) -> None:
Expand Down

0 comments on commit ce6d806

Please sign in to comment.