I'm trying to catch an exception which can be thrown by a factory:
Traceback (most recent call last):
File "/home/taira/azura/.venv/lib/python3.13/site-packages/linkd/container.py", line 264, in _get
self._instances[dependency_id] = await utils.maybe_await(data.factory_method(**injectable_params))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/taira/azura/.venv/lib/python3.13/site-packages/linkd/utils.py", line 96, in maybe_await
return await item
^^^^^^^^^^
File "/home/taira/azura/./azura/lib/injection/koe_injection.py", line 42, in get_new_session
raise ValueError
ValueError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/taira/azura/.venv/lib/python3.13/site-packages/linkd/solver.py", line 407, in __call__
new_kwargs = await self._dependency_func(DI_CONTAINER.get(None), 1 if self._self else 0, args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<string>", line 4, in resolve_dependencies
File "/home/taira/azura/.venv/lib/python3.13/site-packages/linkd/conditions.py", line 202, in resolve
return await container._get(self._order[0].inner_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/taira/azura/.venv/lib/python3.13/site-packages/linkd/container.py", line 266, in _get
raise exceptions.DependencyNotSatisfiableException(
f"could not create dependency {dependency_id!r} - factory raised exception"
) from e
linkd.exceptions.DependencyNotSatisfiableException: could not create dependency 'azura.koe.session.NewSession' - factory raised exception
(the rest of the pipeline exception follows)
But the exception object passed to the error handler:
@loader.error_handler
async def handle(exc: lightbulb.exceptions.ExecutionPipelineFailedException) -> bool:
...
...doesn't seem to have a way to access the original cause of the exception, the ValueError. In exc.causes all I have is the DependencyNotSatisfiableException, and it doesn't seem to have the original exception. Is there something I'm missing here?