File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 3838
3939T = TypeVar ("T" )
4040CoroT : TypeAlias = Callable [..., Coroutine [Any , Any , Any ]]
41- ErrorT : TypeAlias = Callable [..., Coroutine [Any , Any , Any ]]
4241
4342
4443LOGGER : logging .Logger = logging .getLogger (__name__ )
@@ -118,7 +117,7 @@ def __init__(
118117
119118 self ._before_routine : CoroT | None = None
120119 self ._after_routine : CoroT | None = None
121- self ._on_error : CoroT = self . on_error
120+ self ._on_error : CoroT | None = None
122121
123122 self ._stop_on_error : bool = stop_on_error
124123 self ._should_stop : bool = False
@@ -172,6 +171,10 @@ def _can_cancel(self) -> bool:
172171 return self ._task is not None and not self ._task .done ()
173172
174173 async def _call_error (self , error : Exception ) -> None :
174+ if self ._on_error is None :
175+ await self .on_error (error )
176+ return
177+
175178 if self ._injected is not None :
176179 await self ._on_error (self ._injected , error )
177180 else :
You can’t perform that action at this time.
0 commit comments