Skip to content

Commit

Permalink
Improved error handling for trace rpc module. (#3604)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjazgar authored Nov 15, 2021
1 parent 520749b commit 77134c0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Nethermind/Nethermind.JsonRpc/JsonRpcService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using Nethermind.JsonRpc.Modules;
using Nethermind.Logging;
using Nethermind.Serialization.Json;
using Nethermind.State;
using Newtonsoft.Json;
using JsonSerializer = Newtonsoft.Json.JsonSerializer;

Expand Down Expand Up @@ -181,13 +182,19 @@ private async Task<JsonRpcResponse> ExecuteAsync(JsonRpcRequest request, string
}
catch (TargetParameterCountException e)
{
return GetErrorResponse(methodName, ErrorCodes.InvalidParams, e.Message, e.Data, request.Id, returnAction);
return GetErrorResponse(methodName, ErrorCodes.InvalidParams, e.Message, e.Data, request.Id,
returnAction);
}
catch (Exception e) when (e.InnerException is OperationCanceledException)
{
string errorMessage = $"{methodName} request was canceled due to enabled timeout.";
return GetErrorResponse(methodName, ErrorCodes.Timeout, errorMessage, null, request.Id, returnAction);
}
catch (Exception e) when (e.InnerException is InsufficientBalanceException)
{
return GetErrorResponse(methodName, ErrorCodes.InvalidInput, e.InnerException.Message, null, request.Id,
returnAction);
}
finally
{
if (returnImmediately)
Expand Down

0 comments on commit 77134c0

Please sign in to comment.