2929 loguru_logger ,
3030 project_info_provider ,
3131)
32-
33- from ._state import container , factories
32+ from finecode_extension_runner .di import _state
3433
3534
3635def bootstrap (get_document_func : Callable , save_document_func : Callable ):
@@ -49,21 +48,21 @@ def bootstrap(get_document_func: Callable, save_document_func: Callable):
4948 action_runner_instance = action_runner .ActionRunner (
5049 internal_service_func = run_action_wrapper
5150 )
52- container [ilogger .ILogger ] = logger_instance
53- container [icommandrunner .ICommandRunner ] = command_runner_instance
54- container [ifilemanager .IFileManager ] = file_manager_instance
55- container [icache .ICache ] = cache_instance
56- container [iactionrunner .IActionRunner ] = action_runner_instance
51+ _state . container [ilogger .ILogger ] = logger_instance
52+ _state . container [icommandrunner .ICommandRunner ] = command_runner_instance
53+ _state . container [ifilemanager .IFileManager ] = file_manager_instance
54+ _state . container [icache .ICache ] = cache_instance
55+ _state . container [iactionrunner .IActionRunner ] = action_runner_instance
5756
5857 if fine_python_ast is not None :
59- factories [fine_python_ast .IPythonSingleAstProvider ] = (
58+ _state . factories [fine_python_ast .IPythonSingleAstProvider ] = (
6059 python_single_ast_provider_factory
6160 )
6261 if fine_python_mypy is not None :
63- factories [fine_python_mypy .IMypySingleAstProvider ] = (
62+ _state . factories [fine_python_mypy .IMypySingleAstProvider ] = (
6463 mypy_single_ast_provider_factory
6564 )
66- factories [iprojectinfoprovider .IProjectInfoProvider ] = project_info_provider_factory
65+ _state . factories [iprojectinfoprovider .IProjectInfoProvider ] = project_info_provider_factory
6766
6867 # TODO: parameters from config
6968
@@ -73,8 +72,11 @@ async def run_action_wrapper(
7372) -> dict [str , Any ]:
7473 request = schemas .RunActionRequest (action_name = action_name , params = payload )
7574 options = schemas .RunActionOptions (result_format = "json" )
76- # TODO: map exceptions to iactionrunner
77- response = await run_action .run_action (request = request , options = options )
75+
76+ try :
77+ response = await run_action .run_action (request = request , options = options )
78+ except run_action .ActionFailedException as exception :
79+ raise iactionrunner .ActionRunFailed (exception .message )
7880
7981 return response .result
8082
0 commit comments