Skip to content

Commit

Permalink
Add handling for "[-32000] Server error: Timeout error"
Browse files Browse the repository at this point in the history
Looks like in some cases timeout errors come in different format.
  • Loading branch information
vgrichina committed Aug 25, 2020
1 parent 07cb970 commit 487ddf1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/providers/json-rpc-provider.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/providers/json-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class JsonRpcProvider extends Provider {
const errorMessage = `[${response.error.code}] ${response.error.message}: ${response.error.data}`;
// NOTE: All this hackery is happening because structured errors not implemented
// TODO: Fix when https://github.com/nearprotocol/nearcore/issues/1839 gets resolved
if (response.error.data === 'Timeout') {
if (response.error.data === 'Timeout' || errorMessage.includes('Timeout error')) {
throw new TypedError('send_tx_commit has timed out.', 'TimeoutError');
} else {
throw new TypedError(errorMessage);
Expand Down

0 comments on commit 487ddf1

Please sign in to comment.