Refactor ErrorFrame: rename source field to processor for clarity and update related references in FrameProcessor.

This commit is contained in:
richtermb
2025-08-05 13:25:08 -07:00
parent 4476a76ad7
commit efddc4732c
3 changed files with 4 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
removed in a future version. Use the `/start` endpoint in its place. In the removed in a future version. Use the `/start` endpoint in its place. In the
meantime, both endpoints work and deliver equivalent functionality. meantime, both endpoints work and deliver equivalent functionality.
- Added `source` field to `ErrorFrame` to indicate `FrameProcessor` that generated the error. - Added `processor` field to `ErrorFrame` to indicate `FrameProcessor` that generated the error.
## [0.0.77] - 2025-07-31 ## [0.0.77] - 2025-07-31

View File

@@ -657,7 +657,7 @@ class ErrorFrame(SystemFrame):
error: str error: str
fatal: bool = False fatal: bool = False
source: Optional["FrameProcessor"] = None processor: Optional["FrameProcessor"] = None
def __str__(self): def __str__(self):
return f"{self.name}(error: {self.error}, fatal: {self.fatal})" return f"{self.name}(error: {self.error}, fatal: {self.fatal})"

View File

@@ -494,8 +494,8 @@ class FrameProcessor(BaseObject):
Args: Args:
error: The error frame to push. error: The error frame to push.
""" """
if not error.source: if not error.processor:
error.source = self error.processor = self
await self.push_frame(error, FrameDirection.UPSTREAM) await self.push_frame(error, FrameDirection.UPSTREAM)
async def push_frame(self, frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM): async def push_frame(self, frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM):