-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide more detailed on-chain error messages for failed API calls #1509
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaving the wording of the error message up to you. Other than that LGTM.
Hi @dcroote, I am currently testing the issue and wanted to ask about when to expect the error in building the request and how that can be repreoduced. I'm using Beeceptor to mock responses and this works with returning a status code. Could you please advise? I'm also thinking it could be practical to return all or at least several more error status codes (say, there's the openweather example and when you have a bad api key, it sends back an error status code so knowing that could be quite informative for the user). |
Hi @martinkolenic - of the three error messages added ("with status code X", "with no response", and "in building the request"), the first two are the most relevant to test, with the third considered an unlikely fallback. I haven't used Beeceptor, but if you could return different status codes from the API, those should appear in the error message written on chain, like for this Goerli transaction. For the second error message, I imagine that could be tested if Beeceptor has a way to have a long delay / timeout in responding to a request. |
Hi Derek, thanks for the information. Beeceptor does allow delayed responses and setting it to about 600 actually did the trick. Here's a formal test report: Test 1: Check for status code messages Steps: Modify the coingecko example to send requests to a mock Beeceptor endpoint, set up the endpoint to return the 404 code for any request; make request with the local Airnode; change to another code and repeat the request Expected result: Receive more informative error messages for status codes 404, 301, 403 and 409 Test 2: Check for timeout message presence Steps: Modify the coingecko example to send requests to a mock Beeceptor endpoint, set up the endpoint to return a 200 code with a 600 second response; make request with the local Airnode; wait if the request times out Expected result: Receive a timeout message |
@martinkolenic this is great, thanks! |
Closes #1502.
Adds 3 possible error messages depending on the
AxiosError
(note the API error message is not being relayed to avoid publishing sensitive information as explained in this comment):Tested with the
airnode-client-dev
image on Goerli with the same setup as described in #1502 and the error message now includes the 404 status code for the price request of a nonexistent coin: