Skip to content

Commit 48090b6

Browse files
committed
added try catch for Pyre Parsing errors
1 parent 26d1b92 commit 48090b6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

client/commands/v2/pysa_server.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
InitializationSuccess,
3333
InitializationFailure,
3434
)
35+
from api import query, connection as api_connection
36+
from api.connection import PyreQueryError
3537

3638
LOG: logging.Logger = logging.getLogger(__name__)
3739

@@ -60,6 +62,17 @@ def __init__(
6062
self.binary_location = binary_location
6163
self.server_identifier = server_identifier
6264

65+
async def update_errors(self) -> None:
66+
pyre_connection = api_connection.PyreConnection(
67+
Path(self.pyre_arguments.global_root)
68+
)
69+
try:
70+
model_errors = query.get_invalid_taint_models(pyre_connection)
71+
diagnostics = invalid_models_to_diagnostics(model_errors)
72+
await self.show_model_errors_to_client(diagnostics)
73+
except PyreQueryError as e:
74+
await self.log_and_show_message_to_client(f"Error querying Pyre: {e}", lsp.MessageType.WARNING)
75+
6376
async def show_message_to_client(
6477
self, message: str, level: lsp.MessageType = lsp.MessageType.INFO
6578
) -> None:

0 commit comments

Comments
 (0)