fixbug: DebugError

This commit is contained in:
莘权 马 2023-11-24 13:30:00 +08:00
parent 10d9f33150
commit 75dcc8d534
6 changed files with 107 additions and 43 deletions

View file

@ -304,7 +304,13 @@ def print_members(module, indent=0):
def parse_recipient(text):
pattern = r"## Send To:\s*([A-Za-z]+)\s*?" # hard code for now
recipient = re.search(pattern, text)
return recipient.group(1) if recipient else ""
if recipient:
return recipient.group(1)
pattern = r"Send To:\s*([A-Za-z]+)\s*?"
recipient = re.search(pattern, text)
if recipient:
return recipient.group(1)
return ""
def get_class_name(cls) -> str:

View file

@ -96,8 +96,15 @@ class FileRepository:
path_name = self.workdir / filename
if not path_name.exists():
return None
async with aiofiles.open(str(path_name), mode="r") as reader:
doc.content = await reader.read()
try:
async with aiofiles.open(str(path_name), mode="r") as reader:
doc.content = await reader.read()
except FileNotFoundError as e:
logger.info(f"open {str(path_name)} failed:{e}")
return None
except Exception as e:
logger.info(f"open {str(path_name)} failed:{e}")
return None
return doc
async def get_all(self) -> List[Document]: