inferno-core
inferno-core copied to clipboard
FI-2728: Improve JSON Parsing Error Handling for Validator Responses
Summary
Ticket Description: We saw an issue where a validator response contained a null character and it crashed the test runner, so it kept spinning forever. Since we don't control the validator and especially the tx server, make sure an unexpected response doesn't crash anything.
I attempted to reproduce the issue by mocking the validator service with various unexpected response formats, such as null values, bad characters, invalid json (e.g. '{$kd'
), etc.. Using Mockoon to simulate these edge cases, I verified that all exceptions were already being handled properly by the existing rescue StandardError => e
. The test runner did not crash during any of these scenarios.
The change made in this PR is an improvement in how JSON parsing exceptions are handled to ensure that invalid or malformed JSON responses from the validator are correctly caught and the user is informed with clear messaging.