-
Notifications
You must be signed in to change notification settings - Fork 244
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
fix: support non-200 RPC error #1404
base: master
Are you sure you want to change the base?
Conversation
fix: support non-200 RPC error
|
@19Nazar Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: waiting for scoringWe're waiting for maintainer to score this pull request with What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
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.
packages/providers/src/fetch_json.ts
Outdated
@@ -60,10 +60,12 @@ export async function fetchJsonRpc(url: string, json: JsonRpcRequest, headers: o | |||
throw new ProviderError(await res.text(), { cause: status }); |
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.
So when status is other than 200
, the ok is false, so after we get 500
, 408
or another error, we stop here. So I suggest to move this line if (!ok)
to the bottom of the function
Also, have you tested your solution? If not, please test.
@@ -60,10 +60,12 @@ export async function fetchJsonRpc(url: string, json: JsonRpcRequest, headers: o | |||
throw new ProviderError(await res.text(), { cause: status }); | |||
} | |||
|
|||
if (status === 503) { |
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.
What is the reason for removing 503
error? It is still the case as I see in the nearcore
code. It should be retried as well
Hi @19Nazar please let me know if you are going to finish the PR |
Hi, I'll get it done today |
@PolyProgrammist give feedback when you've checked it out |
Pre-flight checklist
Motivation
I want to solve problems and contribute to Near ecosystems
Related issues/PRs
Solved problam with support non-200 RPC error codes this issues #1395