MCPcopy
hub / github.com/nonebot/nonebot2 / handle_exception

Method handle_exception

nonebot/drivers/none.py:96–106  ·  view source on GitHub ↗
(exc_group: BaseExceptionGroup[Exception])

Source from the content-addressed store, hash-verified

94
95 async def _startup(self):
96 def handle_exception(exc_group: BaseExceptionGroup[Exception]) -> None:
97 self.should_exit.set()
98
99 for exc in flatten_exception_group(exc_group):
100 logger.opt(colors=True, exception=exc).error(
101 "<r><bg #f8bbd0>Error occurred while running startup hook."
102 "</bg #f8bbd0></r>"
103 )
104 logger.error(
105 "<r><bg #f8bbd0>Application startup failed. Exiting.</bg #f8bbd0></r>"
106 )
107
108 with catch({Exception: handle_exception}):
109 await self._lifespan.startup()

Callers

nothing calls this directly

Calls 2

flatten_exception_groupFunction · 0.90
setMethod · 0.80

Tested by

no test coverage detected