diff --git a/.changeset/chilly-plants-admire.md b/.changeset/chilly-plants-admire.md new file mode 100644 index 0000000000..8fdb86cdf6 --- /dev/null +++ b/.changeset/chilly-plants-admire.md @@ -0,0 +1,5 @@ +--- +"@near-js/providers": patch +--- + +Update how timeout error is handled. diff --git a/packages/providers/src/json-rpc-provider.ts b/packages/providers/src/json-rpc-provider.ts index 1d3c299c8e..661dc7563b 100644 --- a/packages/providers/src/json-rpc-provider.ts +++ b/packages/providers/src/json-rpc-provider.ts @@ -397,10 +397,7 @@ export class JsonRpcProvider extends Provider { throw parseRpcError(response.error.data); } else { 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' || errorMessage.includes('Timeout error') - || errorMessage.includes('query has timed out')) { + if (response.error.data === 'Timeout') { throw new TypedError(errorMessage, 'TimeoutError'); }