Skip to content

Commit

Permalink
Handle exceptions raised in HandleRequestAsync by sendRequest.
Browse files Browse the repository at this point in the history
  • Loading branch information
allisterb committed Mar 16, 2024
1 parent eaab839 commit 104995b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Stratis.VS.StratisEVM/SolidityLanguageClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public async Task HandleNotificationAsync(string methodName, JToken methodParam,

public async Task<JToken> HandleRequestAsync(string methodName, JToken methodParam, Func<JToken, Task<JToken>> sendRequest)
{
try
try //Handle exceptions raised by vscode-solidity server like https://github.com/juanfranblanco/vscode-solidity/issues/446
{
var resp = await sendRequest(methodParam);
Info("Request {req} {param}: {resp}", methodName, methodParam?.ToString() ?? "", resp?.ToString() ?? "(null)");
Expand Down Expand Up @@ -303,13 +303,13 @@ public async Task<JToken> HandleRequestAsync(string methodName, JToken methodPar
else
{
Info("resp is null");
return JObject.FromObject(new { contents = new { kind = "plaintext", value = "" } });
return resp;
}
}
catch (Exception ex)
{
Error(ex, "Exception thrown handling request {m}.", methodName);
return JObject.FromObject(new { contents = new { kind = "plaintext", value = "" } });
return null;
}
}
}
Expand Down

0 comments on commit 104995b

Please sign in to comment.