Skip to content

Commit

Permalink
fix att bug and show plugin loadding failure (#106)
Browse files Browse the repository at this point in the history
1. enable show error in plugin loading
2. fix raw_text_to_post bug
  • Loading branch information
zhangxu0307 authored Jan 8, 2024
1 parent 078949a commit 73eb9ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion taskweaver/misc/component_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def registry(self) -> Dict[str, component_type]:
return self.get_registry()

def get_list(self, force_reload: bool = False, freshness: Optional[timedelta] = None) -> List[component_type]:
registry = self.get_registry(force_reload, freshness)
registry = self.get_registry(force_reload, freshness, show_error=True)
keys = sorted(registry.keys())
return [registry[k] for k in keys]

Expand Down
8 changes: 6 additions & 2 deletions taskweaver/role/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ def raw_text_to_post(
], f"Invalid send_to value: {value}"
post.send_to = value # type: ignore
else:
type = AttachmentType(type_str)
post.add_attachment(Attachment.create(type=type, content=value))
try:
type = AttachmentType(type_str)
post.add_attachment(Attachment.create(type=type, content=value))
except Exception as e:
self.logger.warning(f"Failed to parse attachment: {d} due to {str(e)}")
continue
event_handler(type_str, value)
parsed_type = (
type
Expand Down

0 comments on commit 73eb9ac

Please sign in to comment.