Skip to content
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

Pick nodes consistently in "npm run dev", and query fixes #394

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

peterbroadhurst
Copy link
Contributor

Proposed changes

Enhancements to:

  • Ensure we re-run queries if we get errors
  • Be consistent in npm run dev that node is on 3000

@peterbroadhurst peterbroadhurst marked this pull request as draft November 6, 2024 08:50
@peterbroadhurst peterbroadhurst marked this pull request as ready for review November 6, 2024 08:52
errorMsg: string,
ignoreStatuses: number[] = []
) => {
const res = await resFn();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was the key fix - that resFn wasn't being await'ed in the previous param structure of returnResponse

} catch {
return {};
}
return (await res.json()).result;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original goal of this try catch was to quietly handle cases where the value returned is not a valid JSON. Note that with this change we assume the response will always be a valid JSON.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very helpful to have that - I couldn't work that out from the code alone, as it seemed to be deliberately translating errors in a success payload. I thought that was the intent of the code.

A note that I didn't see a change / comments / intent described in the changes under #399, so if you have more updates to make a single approach to the different types of errors coming back to the UI true, that would be great.

The "error" categories include:

  • Something that isn't JSON/RPC came back - like a 504 gateway error, which won't be JSON parsable
  • An error specific to a JSON/RPC call came back, with an error code, which could be displayed to a user
  • An error specific to a JSON/RPC call came back, which in that particular case the UI wants to hide from the user (like the fact there is no domain receipt on the node)
  • null came back from a query describing a straight forward not found scenario

@peterbroadhurst peterbroadhurst merged commit 53155c6 into main Nov 7, 2024
3 checks passed
@peterbroadhurst peterbroadhurst deleted the ui-queries branch November 7, 2024 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants