Skip to content

Commit

Permalink
added try catch for Pyre Parsing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
m0mosenpai committed May 29, 2021
1 parent ce5aa89 commit 50617b6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client/commands/v2/pysa_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
InitializationFailure,
)
from api import query, connection as api_connection
from api.connection import PyreQueryError

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

Expand Down Expand Up @@ -67,9 +68,12 @@ async def update_errors(self) -> None:
pyre_connection = api_connection.PyreConnection(
Path(self.pyre_arguments.global_root)
)
model_errors = query.get_invalid_taint_models(pyre_connection)
diagnostics = invalid_models_to_diagnostics(model_errors)
await self.show_model_errors_to_client(diagnostics)
try:
model_errors = query.get_invalid_taint_models(pyre_connection)
diagnostics = invalid_models_to_diagnostics(model_errors)
await self.show_model_errors_to_client(diagnostics)
except PyreQueryError as e:
await self.log_and_show_message_to_client(f"Error querying Pyre: {e}", lsp.MessageType.WARNING)

async def show_message_to_client(
self, message: str, level: lsp.MessageType = lsp.MessageType.INFO
Expand Down

0 comments on commit 50617b6

Please sign in to comment.