Refactor ErrorFrame: rename source field to processor for clarity and update related references in FrameProcessor.
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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})"
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user