Skip to content

Commit 800cc9c

Browse files
committed
feat: improve Exception handling
multiprocessing.Pool does not retain the base exception that caused it to raise. As a result it is not possible under this setup to explicitly capture the RecursionError that is getting raised when Pool attempts to pickle the AST from the parser.
1 parent def63f4 commit 800cc9c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fortls/langserver.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,8 +1491,12 @@ def workspace_init(self):
14911491
for path, result in results.items():
14921492
try:
14931493
result_obj = result.get()
1494-
except:
1495-
result_obj = traceback.format_exc()
1494+
except Exception as e:
1495+
result_obj = (
1496+
"An exception has occured while initialising the workspace.\n"
1497+
f"Exception({(type(e))}): {e}\n"
1498+
+ f"Traceback: {traceback.format_exc()}"
1499+
)
14961500
if isinstance(result_obj, str):
14971501
self.post_message(
14981502
f"Initialization failed for file {path}: {result_obj}"

0 commit comments

Comments
 (0)