Catch exception for JSON to prevent runaway exception when NN calling executeRain function #1236
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@barton2526 discovered a runaway exception (which turned out to be many possible runaway exceptions) when the neural network RPC calls to do a rain on a project. The function
executeRain
throws JSON Error which is handled by univalue/json. This results in aUniValue objError
for reply and display of information in RPC however when neural network which is not calling from the JSON RPC ends up resulting in a run away exception that causes the client to shutdown. This catch will process the same exception as the JSON RPC does and display the error in result to the Neural network client.Possible runaways that could occur before this implementation fix:
This catch now handles these event successfully while providing the rpc reply to neural network with the error message.