Log any asyncio error
							parent
							
								
									8070b16bd0
								
							
						
					
					
						commit
						2cf87146a3
					
				|  | @ -94,6 +94,8 @@ async def run_task( | |||
|         """ | ||||
|         nonlocal err | ||||
|         err = task.exception() | ||||
|         if err: | ||||
|             log.exception(f"asyncio task errorred:\n{err}") | ||||
|         cancel_scope.cancel() | ||||
| 
 | ||||
|     task.add_done_callback(cancel_trio) | ||||
|  | @ -114,6 +116,7 @@ async def run_task( | |||
| 
 | ||||
|     # simple async func | ||||
|     elif inspect.iscoroutine(coro): | ||||
| 
 | ||||
|         with cancel_scope: | ||||
|             # return single value | ||||
|             return await from_aio.receive() | ||||
|  | @ -121,6 +124,7 @@ async def run_task( | |||
|             raise err | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| def run_as_asyncio_guest( | ||||
|     trio_main: Callable, | ||||
| ) -> None: | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue