go
go copied to clipboard
More detailed error for "Account missing" type errors
What problem does your feature solve?
When using the horizon client to query for AccountDetail
, you can hit a 404 for reasons related to your account being missing. This could include having generated a keypair but forgetting to fund it. To improve the UX of hitting this error message we could add a new problem type that extends NotFound with more specific reasons.
I ran into this as someone newer to ecosystem when trying to deploy a contract to futurenet through the cli which AccountDetail
on a horizon client.
What would you like to see?
A split between NotFound errors that are specific to missing rpc interfaces from the ones that are specific to missing resources, and maybe more specific reasons for some classes of missing resource errors.
What alternatives are there?
I'm not sure there are any, the docs talk about this but devs can forget to fund accounts when they're in the flow and a more descriptive error message in that case would be a nice reminder.
I believe I see the path at this by adding Extras.reason
for a new type of resource missing error and then using that when returning NotFound errors from account related queries. If that sounds right then I'm happy to cut this PR adding what I described.
Thanks for the issue. From what I gather you are getting a NotFound
error for an account which doesn't exist. I think that's correct.
A split between NotFound errors that are specific to missing rpc interfaces from the ones that are specific to missing resources, and maybe more specific reasons for some classes of missing resource errors.
Can you elaborate? I am not sure I understand what you mean by specific to missing rpc interfaces from the ones that are specific to missing resources.
I am confused: Where you getting a NotFound
error when requesting information about an account because an RPC method was missing?
Thanks for the issue. From what I gather you are getting a
NotFound
error for an account which doesn't exist. I think that's correct.A split between NotFound errors that are specific to missing rpc interfaces from the ones that are specific to missing resources, and maybe more specific reasons for some classes of missing resource errors.
Can you elaborate? I am not sure I understand what you mean by specific to missing rpc interfaces from the ones that are specific to missing resources.
I am confused: Where you getting a
NotFound
error when requesting information about an account because an RPC method was missing?
The request I was trying to make was one like this one -
aristidesstaffieri@Aristidess-MBP~/stellar/test-token master $ soroban deploy \
--wasm target/wasm32-unknown-unknown/release/test_token.wasm \
--secret-key S... \
--rpc-url http://localhost:8000/soroban/rpc \
--network-passphrase 'Test SDF Future Network ; October 2022'
error: jsonrpc error: RPC call failed: ErrorObject { code: InvalidRequest, message: "Resource Missing", data: None }
Although I do see now how this is technically correct for the error, it did confuse me as a new user of the cli. Since I'm newer to the ecosystem and didn't have the muscle memory to infer that my account my still be "missing" since it was not yet funded even though it had been generated. I think surfacing a more specific error on instances of "missing account" could help users navigate this scenario.
Here's the original thread for context - https://stellarfoundation.slack.com/archives/C030Z9EHVQE/p1675875917223909
I don't think that there's much we can do about this from the Horizon side. If you've created a keypair (client-side) but haven't actually created/funded the account in a transaction, then the account doesn't exist and Horizon has no way to know about that keypair. The client that generated the keypair would be the only entity capable of discerning the "reason" behind the 404 in this case.