Skip to content

Commit ed717f4

Browse files
authored
chore: Improve background RPC timeout error message (#38564)
## **Description** The error message for the `getState` timeout (from UI to background) has been re-worded to avoid misleading users into thinking that the error relates to network RPC endpoints. The current message has repeatedly been confused because we typically use the term "RPC" to refer to network RPC endpoints. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/38564?quickstart=1) ## **Changelog** CHANGELOG entry: Improve error message when UI can't retrieve state from background process ## **Related issues** N/A ## **Manual testing steps** I am not sure how best to reproduce this error, but it's just a copy change so I'm not sure we strictly need to manually test this. ## **Screenshots/Recordings** N/A ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Updates the background RPC client’s getState timeout error message and aligns the unit test expectation. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e06819c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 12180e5 commit ed717f4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/scripts/lib/metaRPCClientFactory.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ describe('metaRPCClientFactory', () => {
179179
);
180180

181181
jest.runOnlyPendingTimers();
182-
await expect(errorPromise).rejects.toThrow('No response from RPC');
182+
await expect(errorPromise).rejects.toThrow(
183+
`Background 'getState' call exceeded timeout`,
184+
);
183185

184186
jest.useRealTimers();
185187
});

app/scripts/lib/metaRPCClientFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export class MetaRPCClient<Api extends FunctionRegistry<Api>> {
186186
if (payload.method === 'getState') {
187187
timer = setTimeout(() => {
188188
this.requests.delete(payload.id);
189-
reject(new Error('No response from RPC'));
189+
reject(new Error(`Background 'getState' call exceeded timeout`));
190190
}, SIXTEEN_SECONDS_AS_MILLISECONDS);
191191
}
192192
this.requests.set(payload.id, { resolve, reject, timer });

0 commit comments

Comments
 (0)