Improve clarity of RPC errors
justinkaseman opened this issue · comments
Description
Communication to various JSON-RPC available blockchains is handled using ethers.js.
When a revert or error occurs within this framework the EA will return a non-descriptive 500 error.
It will be helpful for debugging to have the exact cause more clearly stated in logs & EA responses.
Suggested solutions
Common error description strings could be transformed into a more human friendly description.
Handling RPC level errors in a re-usable and extensible way would be preferred. For example keeping a map of error strings to transformed error strings in the core framework and then importing it in EAs. That way more could be added in the future.
It may be possible to inject error handling logic into ethers. The documentation should be checked for this possibility.
If not, errors could be caught in the EA framework's error handling logic.
Reproduction
- Start the
curve
adapter with a garbageRPC_URL='no'
set. - Send the running adapter a request:
{
"data": {
"from": "LINK",
"to": "USD"
}
}
- Notice that the respone's error message could be more clear that the problem is that the provided RPC_URL could not be connected to:
{
"jobRunID": "1",
"status": "errored",
"statusCode": 500,
"error": {
"name": "AdapterError",
"message": "could not detect network (event=\"noNetwork\", code=NETWORK_ERROR, version=providers/5.4.5)",
"feedID": "LINK/USD"
}
}
Completion
Completion of this ticket looks like the ability to have error handling coverage for all of the different adapters that use Ethers.
At a minimum this would be turning the message "could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.4.5)" into "The provided RPC_URL environment variable of ${RPC_URL} could not be connected to.".
These can be found by searching ethers.Contract(
within the repository.
Some adapters use others adapters to make RPC calls for them (e.g. JSON-RPC). It should be ensured that in these cases the original adapter still displays the correct error.